Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 817
Aaron Digulla Avatar asked Nov 05 '22 05:11

Aaron Digulla


2 Answers

$ 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"
...

That's Funny, It Works On My Machine?

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

like image 69
FauxFaux Avatar answered Nov 07 '22 21:11

FauxFaux


This seems to have been fixed in plexus-compiler-eclipse version 1.9.1 (or maybe some other version between 1.9.1 and 1.7)

like image 23
alex Avatar answered Nov 07 '22 21:11

alex