I was recently
interviewed by Jan for java.sun.com;
where I said: Although most developers do not want to know how
to use the Java Compiler API, it will provide a lot of indirect
benefits.
This was
discussed on comp.lang.java.programmer,
and I think it may have been misunderstood.
99% of Java developers will newer need to know anything about the Java Compiler API (JSR 199). A small number of Java developers will use the API directly. However, the software these few developers make is used by all Java developers. I'm talking about software such as IDEs (NetBeans, Eclipse, IntelliJ IDEA, etc), Java EE application server, build infrastructures such as Maven and Ant, and test frame works. All these pieces of software have one thing in common: they all need to invoke a compiler to translate Java source code to class files. However, 99% of all developers will not and should not care about how the compiler is invoked.
The compiler API becomes interesting for all developers when we start measuring build times in milliseconds instead of seconds (when you invoke Ant from NetBeans), or when start measuring deployment time in seconds, not minutes. These are the indirect benefits you will all notice, without learning how to use the API, as soon as your favorite tool migrates to the API.
If questions about the compiler API ever shows up on a Java
certification exam, please have the examiners call me and I'll set
them straight
That being said, if you are interested in compiler technology and want to hack on the compiler, please come and join us at https://openjdk.dev.java.net/compiler/.
Posted by Lucio Biondi on April 13, 2007 at 10:15 AM PDT #
Posted by Peter von der Ahé on April 13, 2007 at 10:26 AM PDT #
Posted by Lucio Biondi on April 13, 2007 at 10:50 AM PDT #
Posted by Peter von der Ahé on April 13, 2007 at 10:54 AM PDT #
Posted by Maxim Kizub on April 17, 2007 at 08:22 PM PDT #
It is true to say that the meta-programming approach of JSR 199 is limited. Which I think is fine since JSR 199 is not about meta-programming. You use JSR 269 and com.sun.source.* for meta-programming.
I think you are confusing meta-programming of the Java programming language with a general framework for building compiler.
Anyways, you should ask yourself: "do I want to be obnoxious, or do I want to influence what becomes available in future version?"
Posted by Peter von der Ahé on April 17, 2007 at 08:38 PM PDT #
Having a Java Compiler API is a great advance. Thanks. Why not also adding the front-end of a compiler phase into JDK ? The Java Compiler API could be bigger while playing with other tools.
Let's take an example. OCaml is one language I really like and I have already written mostly here about how C# and Java look like moving towards it. OCaml distribution includes ocamllex and ocamlyacc. Then, it is easier to build DSL using OCaml. OK, using ANTLR could already be done within Java space. But, adding such a ANTLR-like to the JDK would enhance the "Java as platform" message.
What do you think about it ?
Posted by Dominique De Vito on April 23, 2007 at 10:59 PM PDT #
Posted by Johannes Rieken on May 10, 2007 at 02:03 AM PDT #