Groovy-Eclipse at Eclipsecon2010


Published on

With the release of Groovy-Eclipse 2.0.1, we have produced compelling dynamic language support for Groovy in Eclipse. This tool support includes tight integration with JDT, type inferencing throughout, and extensibility for custom DSLs such as Grails.

In this talk, we will explore the power of Groovy-Eclipse in helping to create Groovy and mixed Groovy-Java projects in Eclipse. Through the use of a few simple examples. We will then discuss the internals, including JDT integration, refactoring support, and the inferencing engine. The last part of the talk will show a simple example of extensibility for custom Groovy DSLs.

This talk describes the tooling side of Groovy-Eclipse, please see our related talk "Extending the Eclipse Java Compiler to integrate support for other languages: lessons learned from Groovy Eclipse" that details our extensions to the JDT compiler for multi-language support.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Groovy-Eclipse at Eclipsecon2010

  1. 1. Getting Groovy with Eclipse: Next generation tool support for dynamic languages Andrew Eisenberg SpringSource a division of VMWare
  2. 2. What is Groovy-Eclipse? <ul><li>Eclipse tool support for the Groovy programming language </li></ul><ul><li>Recent release of Groovy-Eclipse 2.0.1 </li></ul><ul><li>Two Goals: </li></ul><ul><ul><li>Deep integration with Java Development Tools (JDT) </li></ul></ul><ul><ul><li>Editing support for Groovy's dynamicism </li></ul></ul>
  3. 3. What is Groovy? <ul><li>This is Java: public class Main { public static void main(String[] args) { System.out.println( “Hello, EclipseCon.” ); } } </li></ul>
  4. 4. What is Groovy? <ul><li>This is Groovy: public class Main { public static void main(String[] args) { System.out.println( “Hello, EclipseCon.” ); } } </li></ul>
  5. 5. What is Groovy? <ul><li>This is really Groovy: print “Hello, EclipseCon.” </li></ul><ul><li>Groovy is a dynamically typed JVM language </li></ul><ul><li>Builds upon the strengths of Java </li></ul><ul><ul><li>syntax, libraries, runtime, ... </li></ul></ul><ul><li>Supports extra features </li></ul><ul><ul><li>scripting, meta-programming, DSLs, … </li></ul></ul>
  6. 6. <ul><li>Deep integration with JDT </li></ul><ul><li>Editing support for Groovy's dynamicism </li></ul>Groovy-Eclipse <ul><ul><li>JDT compiler integration (Demo 1) </li></ul></ul><ul><ul><li>Debug support (Demo 2) </li></ul></ul><ul><ul><li>Groovy type inferencing (Demo 3) </li></ul></ul>
  7. 7. What is deep integration with JDT? <ul><li>Optimize Edit / Save / Compile / Test </li></ul><ul><ul><li>Same level of quality: Java <-> Groovy </li></ul></ul><ul><li>Similar feature set where makes sense </li></ul><ul><li>Seamless Cross-referencing </li></ul>
  8. 8. How to achieve Deep integration <ul><li>Extended JDT compiler </li></ul><ul><ul><li>Compiles both Java and Groovy </li></ul></ul><ul><ul><li>No need for stub generation </li></ul></ul><ul><li>Compiler output not just class files </li></ul><ul><ul><li>Abstract Syntax Tree (AST) </li></ul></ul><ul><ul><li>Java model </li></ul></ul>
  9. 9. Demo 1 <ul><li>JDT – Groovy Compiler integration </li></ul>
  10. 10. Debug support <ul><li>Much like as in Java: </li></ul><ul><ul><li>launching applications, tests </li></ul></ul><ul><ul><li>breakpoints </li></ul></ul><ul><ul><li>stepping </li></ul></ul><ul><ul><li>variables view </li></ul></ul><ul><ul><li>hot swap (new!) </li></ul></ul><ul><ul><li>display view (work in progress) </li></ul></ul><ul><li>But, also: </li></ul><ul><ul><li>launching scripts </li></ul></ul><ul><ul><li>closure support </li></ul></ul><ul><ul><li>filter uninteresting stack frames </li></ul></ul>
  11. 11. Demo 2 <ul><li>Debugging – integration with JDT </li></ul>
  12. 12. <ul><li>Inferencing engine </li></ul><ul><li>guess type information statically </li></ul><ul><li>def x </li></ul><ul><li>x = (-1).abs() </li></ul><ul><li>x = “foo” </li></ul><ul><li>x.abs() </li></ul>IDE support for Groovy's dynamicism x instanceof String x instanceof Integer MissingPropertyException!!!
  13. 13. Inferencing Engine is extensible <ul><li>Custom DSLs can plug in (e.g., Grails) </li></ul><ul><li>Used for many parts of the UI: </li></ul><ul><ul><li>Content Assist </li></ul></ul><ul><ul><li>Navigation </li></ul></ul><ul><ul><li>Search </li></ul></ul><ul><ul><li>Underlining unknown references </li></ul></ul>
  14. 14. Demo 3 <ul><li>Type inferencing provides IDE support for groovy dynamicism </li></ul>
  15. 15. Groovy-Eclipse <ul><li>Deep integration with JDT </li></ul><ul><ul><li>Editor </li></ul></ul><ul><ul><li>Compiler </li></ul></ul><ul><ul><li>Debugger </li></ul></ul><ul><li>Support for Groovy's dynamicism </li></ul><ul><ul><li>Type inferencing </li></ul></ul>
  16. 16. Eclipse is now Groovy! <ul><li>Groovy-Eclipse: </li></ul><ul><li> </li></ul><ul><li>Andrew Eisenberg </li></ul><ul><li>[email_address] </li></ul><ul><li>Thank you! </li></ul>
  17. 17. JDT Compiler integration .groovy/.java sources Generate .class files or Java model Generate .class files or Java model Generate Select parser Eclipse parser .java files Groovy parser .groovy files Parse Write .class files or cache Java model Resolve references across all files Resolve For IDE operations (Search, content assist...)