从命令行运行时,Eclipse的Java编译器会生成不同的堆栈跟踪

Aar*_*lla 5 java eclipse compiler-construction

Eclipse Java编译器的一个小知识就是可以从命令行运行它.

这很好用(修补plexus编译器以使用最新版本).

我的问题:当我从命令行编译代码时,堆栈跟踪是不同的.例如,当我在IDE中运行编译器时,我得到了这个输出:

     at com.some.Foo.method(Foo.java:312)
Run Code Online (Sandbox Code Playgroud)

但是当我从命令行编译代码时,我得到了这个:

     at com.some.Foo.method(com.some.Foo:312)
                            ^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)

这是怎么回事?

分析类文件javap给出:

SourceFile: "Foo.java"
Run Code Online (Sandbox Code Playgroud)

SourceFile: "com.some.Foo"
Run Code Online (Sandbox Code Playgroud)

可能导致这种情况的任何想法?

Aar*_*lla 0

我正在使用修补程序plexus-compiler-eclipse(我修补了 POM 以包含 3.7/Helios 编译器)。

在类中EclipseJavaCompiler.CompilationUnit,有这样的代码:

    public char[] getFileName()
    {
        return className.toCharArray();
    }
Run Code Online (Sandbox Code Playgroud)

应该是

    public char[] getFileName()
    {
        return sourceFile.toCharArray();
    }
Run Code Online (Sandbox Code Playgroud)