javaeclipse

Eclipse's Java Compiler produces different stack traces when run from the command line


A little know feature of the Eclipse's Java compiler is that you can run it from the command line.

This works well (after patching plexus-compiler to use the latest release).

My problem: The stack traces are different when I compile the code from the command line. For example, when I run the compiler in the IDE, I get this output:

     at com.some.Foo.method(Foo.java:312)

but when I compile the code from the command line, I get this:

     at com.some.Foo.method(com.some.Foo:312)
                            ^^^^^^^^^^^^

What's going here???

Analyzing the class files with javap gives:

SourceFile: "Foo.java"

and

SourceFile: "com.some.Foo"

Any ideas what might cause this?


Solution

  • I'm using a patched plexus-compiler-eclipse (I patched the POM to include the 3.7/Helios compiler).

    In the class EclipseJavaCompiler.CompilationUnit, there is this code:

        public char[] getFileName()
        {
            return className.toCharArray();
        }
    

    which should be

        public char[] getFileName()
        {
            return sourceFile.toCharArray();
        }