Compiler used in groovy-eclipse-compiler

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiler used in groovy-eclipse-compiler

Claudio Clemens
Hi there,

I'm using the groovy-eclipse-compiler (2.7.0) with maven. But we don't
use eclipse here. I just have some questions about which compiler is
used at the end of the day. So I'll try to summarize what I found in the
web.

The default maven compiler (maven-compiler-plugin) compiles using
javax.tools.JavaCompiler, so using the default compiler from the JDK
(Oracle or OpenJDK)
But which compiler is used when using the groovy-eclipse-compiler. Is
maven now using the eclipse-compiler from the JDT? Or is it using a
modified version of the JDT? Or of the JDK?

My concern is that we used the default maven compiler for many years, so
should I expect problems or differences using the
groovy-eclipse-compiler? Are both compilers so different?

Or I'm just mixing the thinks and groovy-eclipse-compiler just uses the
default compiler doing some kind of pre-processing beforehand?

How does groovy-eclipse-compiler compiles under-the-hood?

Thanks,

Claudio

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Compiler used in groovy-eclipse-compiler

Andy Clement
This article from a while back talks about how groovy-eclipse joins the Eclipse Java compiler and the groovy compiler together: https://spring.io/blog/2009/07/30/a-groovier-eclipse-experience

I'm no maven guru but if you are using groovy-eclipse maven to compile your mixed java/groovy project you are going to be using groovyc to build the groovy parts and the Eclipse java compiler to build the java parts. Is the eclipse compiler identical to javac? No, they do things differently and in some situations produce slightly different byte code (that effectively does the same thing). I think the eclipse compiler has more configurable warnings/checks and null analysis built in (which javac does not), if you want to use that feature.

> My concern is that we used the default maven compiler for many years, so
> should I expect problems or differences using the
> groovy-eclipse-compiler? Are both compilers so different?

I'd say in about 95-99% of situations they will likely produce the same byte code. Constant pool entries *may* be in a different order but that doesn't really matter. The places I've seen slight variation are serializable lambda naming and (IIRC) constructors for non-static inner classes.  But it should all run just the same.

cheers,
Andy


On 13 June 2014 04:50, Claudio Clemens <[hidden email]> wrote:
Hi there,

I'm using the groovy-eclipse-compiler (2.7.0) with maven. But we don't
use eclipse here. I just have some questions about which compiler is
used at the end of the day. So I'll try to summarize what I found in the
web.

The default maven compiler (maven-compiler-plugin) compiles using
javax.tools.JavaCompiler, so using the default compiler from the JDK
(Oracle or OpenJDK)
But which compiler is used when using the groovy-eclipse-compiler. Is
maven now using the eclipse-compiler from the JDT? Or is it using a
modified version of the JDT? Or of the JDK?

My concern is that we used the default maven compiler for many years, so
should I expect problems or differences using the
groovy-eclipse-compiler? Are both compilers so different?

Or I'm just mixing the thinks and groovy-eclipse-compiler just uses the
default compiler doing some kind of pre-processing beforehand?

How does groovy-eclipse-compiler compiles under-the-hood?

Thanks,

Claudio

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

    http://xircles.codehaus.org/manage_email