Java Mailing List Archive

http://www.gg3721.com/

Home » eclipse-plugin-dev.groovy »

Re: [groovy-eclipse-plugin-dev] Error reporting for java files

Jochen Theodorou

2009-04-18

Replies: Find Java Web Hosting

Author LoginPost Reply
Andrew Eisenberg schrieb:
> Hi all,
>
> Working on removing the javaBuilder from the eclipse plugin. I'm
> getting close. The entire Groovy-Eclipse plugin (except for one test
> class) compiles and all tests pass (when running the tests from the
> newly compiled plugin, except for that test class).
>
> I have a problem, though. When sending Java files to groovyc (which
> in turn sends them to javac) all errors are reported back as text and
> I don't think warnings are reported at all.
>
> However, the plugin needs to be able to convert that text into
> IMarkers so that they can appear in the problems view. Does anyone
> have any experience with calling javac programmatically and how to
> handle its output? Or does anyone know where to look for more
> information?

I assume you mean the normal Sun javac. In that case a look in
groovy-core JavacJavaCompiler shows how the compiler is handled.
Basically we call the compile method with a PrintStream and if javac
returns an error we use the printstream to show the error text as we put
that information into SimpleMessage. That means text only. Javac is more
or less closed source, and widely undocumented... Remember I am talking
here about Java 1.4 / 1.5

In 1.6 we have the compiler API
(http://java.sun.com/javase/6/docs/api/javax/tools/JavaCompiler.html)
which we could use, but currently we don't do that. So if you want to
use the sun compiler and not JDT, then I would say either parse the
error messages or require 1.6.

Using the JDT compiler programaticaly doesn't so complicated as well.

bye blackdrag

--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.