Eclipse Java Compiler Creates Different Stack Traces When Launched From Command Line

A minor feature of the Eclipse Java compiler is that you can run it from the command line .

This works well (after fixing the plexus compiler merge to use the latest version).

My problem: stack traces are different when compiling 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 the following:

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

What's going on here???

Analysis of class files using javapgives:

SourceFile: "Foo.java"

and

SourceFile: "com.some.Foo"

Any ideas what might cause this?

+5
source share
3 answers

plexus-compiler-eclipse ( POM, 3.7/Helios).

EclipseJavaCompiler.CompilationUnit :

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

    public char[] getFileName()
    {
        return sourceFile.toCharArray();
    }
0
$ cat baz/Bar.java
class Foo {
}

$ java -jar eclipse/plugins/org.eclipse.jdt.core_3.8.0.v_C19.jar baz/Bar.java

$ javap -c baz/Foo.class
Compiled from "Bar.java"
...

, ?

Win7, Java 7, Eclipse 3.8.0 ( Indigo, 20110615-0604).

+1

This seems to have been fixed in plexus-compiler-eclipse version 1.9.1 (or possibly in a different version between 1.9.1 and 1.7)

+1
source

All Articles