如何使用日食Java 17的蚂蚁预览功能构建
<target name="compile" depends="init" description="Compile the source.">
<javac srcdir="${src}" classpathref="classpath" destdir="${build.bin}" compiler="modern" debug="true" debuglevel="lines,vars,source" includeantruntime="false" source="17" target="17" />
</target>
Eclipse不会构建,因为我的开关包含预览代码。如何使用ANT(build.xml)启用预览并允许编译?
错误:开关语句中的模式是一个预览功能,是 默认情况下禁用。
<target name="compile" depends="init" description="Compile the source.">
<javac srcdir="${src}" classpathref="classpath" destdir="${build.bin}" compiler="modern" debug="true" debuglevel="lines,vars,source" includeantruntime="false" source="17" target="17" />
</target>
Eclipse won't build cause my switch contains preview code. How can I enable preview and allow compilation using ANT (build.xml)?
error: patterns in switch statements are a preview feature and are
disabled by default.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用ant
&lt; compilerarg&gt;
元素,可以嵌套在
&lt; javac&gt;
元素中。具体来说,您需要
javac
- enable-preview
参数。示例:
compilerarg
的更多信息和示例可以在此处找到: ANT:ANT:将Compilerarg传递到JavacYou can use the Ant
<compilerarg>
element, which can be nested inside the<javac>
element.Specifically, you need the
javac
--enable-preview
argument.Example:
More information and examples for
compilerarg
can be found here: Ant: passing compilerarg into javac