【问题标题】:Preserving argument names in Ant-javac在 Ant-javac 中保留参数名称
【发布时间】:2017-01-18 10:38:22
【问题描述】:

问题的简短摘要Preserving parameter/argument names in compiled java classes

为了保留参数名称,必须使用 javac -g:vars 作为编译器选项来编译 Java 源代码

我通常使用 Ant javac 任务进行编译。如何调整它以保留方法参数名称?

当前代码如下:

<javac includeantruntime="false" srcdir="src" destdir="build/compiled" deprecation="on" target="1.7" source="1.7" debug="true" verbose="false" classpathref="project.classpath" encoding="utf-8" />

【问题讨论】:

    标签: java ant


    【解决方案1】:

    由于javac 开发人员决定将其绑定到g 开关,debugdebuglevel 属性应该可以工作

    <javac debug="true" debuglevel="vars" .... />
    

    通常,您始终可以使用嵌套的compilerarg 来传递任意附加命令行参数。你的情况

    <javac includeantruntime="false" srcdir="src" destdir="build/compiled" deprecation="on" target="1.7" source="1.7" debug="true" verbose="false" classpathref="project.classpath" encoding="utf-8">
        <compilerarg value="-g:vars"/>
    </javac>
    

    应该这样做。

    【讨论】:

    • 对不起,我从来没有接受过这个答案,因为不幸的是,它对我没有用
    猜你喜欢
    • 2019-03-12
    • 2012-07-15
    • 2010-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多