SlideShare a Scribd company logo
Scala Support in Eclipse
Monkey-patching the JDT for fun and profit?




                   Miles Sabin, Chuusai Ltd.
                    http://www.chuusai.com/

               http://uk.linkedin.com/in/milessabin
                      http://twitter.com/milessabin
Outline
●
    JVM Languages Need Java-level Tools
●
    The Scala IDE for Eclipse
●
    History
●
    How to Move Forward?
●
    AspectJ and Equinox Aspects
●
    Who is Using This Approach?
●
    Retrospect and Prospects
The Need for Java-level Tools
●
    Many of the new JVM Languages offer
    significant productivity gains over Java, but
    ...
●
    Mainstream adoption requires
    improvements across the entire toolchain
    ●
        A x2 productivity gain at the language level is
        irrelevant if there's a /2 loss at the tool level
●
    Especially so for IDEs
The Need for Java-level Tools
●
    A subset of JVM languages are also “Java-
    compatible”
    ●
        Close source and binary mapping to Java
        –   Scala, Groovy, JavaFX, AspectJ
●
    This holds out hope that many Java tools
    will Just Work, or work with minor
    adaptation
    ●
        eg. Java annotation driven tools generally work
        as expected with Scala
●
    Additional promise of gradual migration
The Need for Java-level Tools
●
    Does this carry over to IDEs?
    ●
        On the positive side there is much common
        infrastructure across languages
        –   This is reflected in IDE extension APIs
    ●
        Buts it's not enough to provide orthogonal
        support
        –   Gradual migration demands that major features of
            the Java tooling be aware of new language artefacts
    ●
        The big value features are the ones which are
        informed by language semantics
        –   Typically private to IDEs language tooling
The Scala IDE for Eclipse
●
    The Scala tooling for Eclipse is an attempt
    to answer the preceeding question in the
    positive
●
    The aim of the project is to achieve tooling
    which approaches that of the Eclipse JDT
    but with vastly less effort
History 1
●
    Started very early on in Scala's timeline
    (early 2005)
●
    Very simple IDE plugin
●
    Little functionality beyond basic syntax
    highlighting and build invocation
●
    Written in Java
●
    There was a least one other similar offering
    at the time: Scaliptor
History 2
●
    Announced December 2005, first release
    February 2006 (2.1.0)
●
    Rewritten in Scala
●
    Some semantic features acquired (eg.
    limited auto-completion)
●
    Even at this early stage requests for the
    ability to mix Java and Scala and JDT
    interop were coming in
History 3
●
    Announced June 2007, first release
    February 2008
●
    Attempted much deeper integration with
    the Scala compiler,
    ●
        Interactive error reporting
    ●
        Semantic highlighting
    ●
        Incremental compilation
    ●
        Dependency management
●
    Many hooks added to scalac
History 4
●
    Start of my involvement (May 2008)
●
    Prompted by very generous sponsorship by
    EDF Trading
●
    Primary goals
    ●
        Ease Java/Scala migation
        –   Mixed Scala/Java compilation in scalac
        –   Mixed Scala/Java projects in Eclipse
    ●
        Improved Eclipse stability and release process
History 4
●
    First commit to trunk in July 2008
●
    Results of the work first visible in
    2.7.2.RC1 in August 2008
●
    Final 2.7.2 release in November
●
    Goals somewhat met,
    ●
        Mixed Scala/Java enabled in scalac and Eclipse
    ●
        Release process dramatically improved
    ●
        However JDT integration limited and stability
        issues remain
How to Move Forward?
●
    Various non-options
    ●
        Fork Eclipse?
        –   It's open source, but too big and too rapidly
            changing. Maintaining a a patch against it would be
            a huge effort
        –   We want users to be able to install our tools into
            their existing eclipse environments
        –   If several JVM languages fork the JDT which one
            wins?
How to Move Forward?
●
    Various non-options
    ●
        Lobby for extensions to the JDT?
        –   Andrew Eisenberg's patch has been languishing in
            Eclipse Bugzilla for 3+ years
        –   JDT team understandably reluctant to see private
            implementation exposed as public API
        –   Alternative JVM languages still a minority interest,
            so little business motivation to make the change
●
    Fortunately AOP provides us with a Plan B
AspectJ and Equinox Aspects
●
    AspectJ is a well-know AOP extension to
    Java
    ●
        Allows behaviour of existing Java classes to be
        modified
        –   Pointcuts specify slices through execution flow
        –   “Advice” is code which is executed before, after or
            completely replacing original specified by pointcuts
AspectJ and Equinox Aspects
●
    Opinions are divided on AOP
    ●
        There are some compelling use cases
        –   Logging, error handling
        –   These cases are typically passive and observational
    ●
        Aspects can also actively modify behaviour, but
        –   It's a gross violation of encapsulation
        –   It can obscure the flow of execution
    ●
        Violating encapsulation is a bad thing ...
        –   ... except when that's exactly what you need to do!
        –   In which case AOP is an industrial strength tool
AspectJ and Equinox Aspects
●
    A collection of aspects is effectively a patch
●
    AspectJ was used to retrofit the desired
    extensibility features to the JDT and
    expose them via public API
●
    The key modification:
    ●
        The JDT's CompilationUnit is the entry point to
        it's internal model, but it assumes Java source
    ●
        An aspect can turn its constructor into a
        factory method
AspectJ and Equinox Aspects
●
    One more piece of the puzzle
    ●
        How to get these aspects applied to an Eclipse
        Installation?
    ●
        We can't require a custom Eclipse build or
        we're back to square one
●
    Enter Equinox Aspects
    ●
        Work of Martin Lippert
    ●
        An OSGi framework extension supporting the
        weaving of aspects into binaries at load time
Who's Using This Approach?
●
    Unsurprisingly the AspectJ tooling for
    Eclipse (AJDT) was the first
●
    The Scala tooling followed soon after
●
    JavaFX is the most recent addition
●
    The Groovy Eclipse tooling is taking the
    patch approach
●
    There has been significant collaboration
    across these projects
Retrospect and Prospects
●
    The results are a qualified success
●
    But the patch was premature,
    ●
        Experience has shown that although the initial
        round of JDT modifications removed the
        biggest hurdles,
        –   There are still many scenarios where Java source
            assumptions are made
        –   The retrofitted public API maps JVM language
            constructs to the JDT's model in a way which best
            fits Java extensions rather than new languages
Retrospect and Prospects
●
    More cross-language collaboration needed
    ●
        We need to draw on the experiences of the
        various groups and factor out common API and
        functionality
    ●
        We need to encourage other languages to
        follow, esp. languages not so close to Java
●
    We need to work with the JDT team to roll
    these changes into Eclipse
Demo
Find Out More
●
    Scala's home at EPFL
    http://www.scala-lang.org
    ●
        See also the scala-user and scala-tools mailing
        lists
●
    Scala IDE installation
    http://www.scala-lang.org/node/94
    ●
        Update site for 2.8.0 Beta 1
    http://www.scala-lang.org/
            scala-eclipse-plugin-beta-preview
Scala Support in Eclipse
Monkey-patching the JDT for fun and profit?




                   Miles Sabin, Chuusai Ltd.
                    http://www.chuusai.com/

               http://uk.linkedin.com/in/milessabin
                      http://twitter.com/milessabin

More Related Content

PDF
JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?
PDF
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
PDF
The Scala IDE for Eclipse - Retrospect and Prospect for 2.8.0
PDF
Smart Internationalization assistance and resource translation tools
PDF
Effective Spring on Kubernetes
PDF
Counterclockwise past present future
PDF
Java 9, JShell, and Modularity
PDF
Java SE 9 modules (JPMS) - an introduction
JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
The Scala IDE for Eclipse - Retrospect and Prospect for 2.8.0
Smart Internationalization assistance and resource translation tools
Effective Spring on Kubernetes
Counterclockwise past present future
Java 9, JShell, and Modularity
Java SE 9 modules (JPMS) - an introduction

What's hot (20)

PPTX
Java 9 Module System Introduction
PDF
It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15
PDF
History of java
PDF
itft-Java evolution
PDF
20091226 名古屋SGGAE/J勉強会発表資料『Lift on GAE/J』
PPTX
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
PDF
I18N refactoring support and the TapiJI online translator
ODP
The Evolution of Java
PPTX
Java modules using project jigsaw@jdk 9
PPT
The Evolution of Java
PPTX
Java 9 Modularity and Project Jigsaw
PPSX
Introduction to Java
PDF
Android Mobile Continuous Integration. UA Mobile 2016.
PDF
Java Desktop 2019
PDF
Programmatic Load of the Oracle Clinical Global Library
PPTX
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
PDF
Java modules
PDF
History of Java 2/2
PDF
How and why to upgrade to java 16 or 17
PDF
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
Java 9 Module System Introduction
It's a JDK- Jungle Out There – JDK 15 and OpenJDK 15
History of java
itft-Java evolution
20091226 名古屋SGGAE/J勉強会発表資料『Lift on GAE/J』
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
I18N refactoring support and the TapiJI online translator
The Evolution of Java
Java modules using project jigsaw@jdk 9
The Evolution of Java
Java 9 Modularity and Project Jigsaw
Introduction to Java
Android Mobile Continuous Integration. UA Mobile 2016.
Java Desktop 2019
Programmatic Load of the Oracle Clinical Global Library
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Java modules
History of Java 2/2
How and why to upgrade to java 16 or 17
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
Ad

Similar to Eclipsecon 2010 - Scala Support in Eclipse (20)

PDF
Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...
PDF
What's New In JDT ?
PDF
EclipseCon 2010 - What's new in JDT
PDF
Eclipse & java based modeling platforms for smart phone
ODP
Whats new in Eclipse Indigo ? (@DemoCamp Grenoble 2011)
PPT
Eclipse
PDF
Java [modo de compatibilidad]
PPT
Java
PDF
Java: Rumours of my demise are greatly exaggerated
PDF
Eclipse plug in development
PPT
SIGAda Hibachi Workshop Presentation
PDF
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
KEY
Introduction to EclipseRT (JAX 2010)
PPTX
EclipseDay Lyon: What’s happening these days at Eclipse?
PDF
Jozi-JUG JDK 9 Unconference
PPTX
Eclipse Developement @ Progress Software
PDF
Os Tibbittstutorial
PDF
JCConf 2018 - Retrospect and Prospect of Java
PDF
EclipseCon Europe 2017 - State of the Union
Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...
What's New In JDT ?
EclipseCon 2010 - What's new in JDT
Eclipse & java based modeling platforms for smart phone
Whats new in Eclipse Indigo ? (@DemoCamp Grenoble 2011)
Eclipse
Java [modo de compatibilidad]
Java
Java: Rumours of my demise are greatly exaggerated
Eclipse plug in development
SIGAda Hibachi Workshop Presentation
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Introduction to EclipseRT (JAX 2010)
EclipseDay Lyon: What’s happening these days at Eclipse?
Jozi-JUG JDK 9 Unconference
Eclipse Developement @ Progress Software
Os Tibbittstutorial
JCConf 2018 - Retrospect and Prospect of Java
EclipseCon Europe 2017 - State of the Union
Ad

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Big Data Technologies - Introduction.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Electronic commerce courselecture one. Pdf
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
sap open course for s4hana steps from ECC to s4
Understanding_Digital_Forensics_Presentation.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
Big Data Technologies - Introduction.pptx
NewMind AI Weekly Chronicles - August'25 Week I
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectroscopy.pptx food analysis technology
20250228 LYD VKU AI Blended-Learning.pptx
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Diabetes mellitus diagnosis method based random forest with bat algorithm
Unlocking AI with Model Context Protocol (MCP)
MIND Revenue Release Quarter 2 2025 Press Release
Electronic commerce courselecture one. Pdf
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
Agricultural_Statistics_at_a_Glance_2022_0.pdf

Eclipsecon 2010 - Scala Support in Eclipse

  • 1. Scala Support in Eclipse Monkey-patching the JDT for fun and profit? Miles Sabin, Chuusai Ltd. http://www.chuusai.com/ http://uk.linkedin.com/in/milessabin http://twitter.com/milessabin
  • 2. Outline ● JVM Languages Need Java-level Tools ● The Scala IDE for Eclipse ● History ● How to Move Forward? ● AspectJ and Equinox Aspects ● Who is Using This Approach? ● Retrospect and Prospects
  • 3. The Need for Java-level Tools ● Many of the new JVM Languages offer significant productivity gains over Java, but ... ● Mainstream adoption requires improvements across the entire toolchain ● A x2 productivity gain at the language level is irrelevant if there's a /2 loss at the tool level ● Especially so for IDEs
  • 4. The Need for Java-level Tools ● A subset of JVM languages are also “Java- compatible” ● Close source and binary mapping to Java – Scala, Groovy, JavaFX, AspectJ ● This holds out hope that many Java tools will Just Work, or work with minor adaptation ● eg. Java annotation driven tools generally work as expected with Scala ● Additional promise of gradual migration
  • 5. The Need for Java-level Tools ● Does this carry over to IDEs? ● On the positive side there is much common infrastructure across languages – This is reflected in IDE extension APIs ● Buts it's not enough to provide orthogonal support – Gradual migration demands that major features of the Java tooling be aware of new language artefacts ● The big value features are the ones which are informed by language semantics – Typically private to IDEs language tooling
  • 6. The Scala IDE for Eclipse ● The Scala tooling for Eclipse is an attempt to answer the preceeding question in the positive ● The aim of the project is to achieve tooling which approaches that of the Eclipse JDT but with vastly less effort
  • 7. History 1 ● Started very early on in Scala's timeline (early 2005) ● Very simple IDE plugin ● Little functionality beyond basic syntax highlighting and build invocation ● Written in Java ● There was a least one other similar offering at the time: Scaliptor
  • 8. History 2 ● Announced December 2005, first release February 2006 (2.1.0) ● Rewritten in Scala ● Some semantic features acquired (eg. limited auto-completion) ● Even at this early stage requests for the ability to mix Java and Scala and JDT interop were coming in
  • 9. History 3 ● Announced June 2007, first release February 2008 ● Attempted much deeper integration with the Scala compiler, ● Interactive error reporting ● Semantic highlighting ● Incremental compilation ● Dependency management ● Many hooks added to scalac
  • 10. History 4 ● Start of my involvement (May 2008) ● Prompted by very generous sponsorship by EDF Trading ● Primary goals ● Ease Java/Scala migation – Mixed Scala/Java compilation in scalac – Mixed Scala/Java projects in Eclipse ● Improved Eclipse stability and release process
  • 11. History 4 ● First commit to trunk in July 2008 ● Results of the work first visible in 2.7.2.RC1 in August 2008 ● Final 2.7.2 release in November ● Goals somewhat met, ● Mixed Scala/Java enabled in scalac and Eclipse ● Release process dramatically improved ● However JDT integration limited and stability issues remain
  • 12. How to Move Forward? ● Various non-options ● Fork Eclipse? – It's open source, but too big and too rapidly changing. Maintaining a a patch against it would be a huge effort – We want users to be able to install our tools into their existing eclipse environments – If several JVM languages fork the JDT which one wins?
  • 13. How to Move Forward? ● Various non-options ● Lobby for extensions to the JDT? – Andrew Eisenberg's patch has been languishing in Eclipse Bugzilla for 3+ years – JDT team understandably reluctant to see private implementation exposed as public API – Alternative JVM languages still a minority interest, so little business motivation to make the change ● Fortunately AOP provides us with a Plan B
  • 14. AspectJ and Equinox Aspects ● AspectJ is a well-know AOP extension to Java ● Allows behaviour of existing Java classes to be modified – Pointcuts specify slices through execution flow – “Advice” is code which is executed before, after or completely replacing original specified by pointcuts
  • 15. AspectJ and Equinox Aspects ● Opinions are divided on AOP ● There are some compelling use cases – Logging, error handling – These cases are typically passive and observational ● Aspects can also actively modify behaviour, but – It's a gross violation of encapsulation – It can obscure the flow of execution ● Violating encapsulation is a bad thing ... – ... except when that's exactly what you need to do! – In which case AOP is an industrial strength tool
  • 16. AspectJ and Equinox Aspects ● A collection of aspects is effectively a patch ● AspectJ was used to retrofit the desired extensibility features to the JDT and expose them via public API ● The key modification: ● The JDT's CompilationUnit is the entry point to it's internal model, but it assumes Java source ● An aspect can turn its constructor into a factory method
  • 17. AspectJ and Equinox Aspects ● One more piece of the puzzle ● How to get these aspects applied to an Eclipse Installation? ● We can't require a custom Eclipse build or we're back to square one ● Enter Equinox Aspects ● Work of Martin Lippert ● An OSGi framework extension supporting the weaving of aspects into binaries at load time
  • 18. Who's Using This Approach? ● Unsurprisingly the AspectJ tooling for Eclipse (AJDT) was the first ● The Scala tooling followed soon after ● JavaFX is the most recent addition ● The Groovy Eclipse tooling is taking the patch approach ● There has been significant collaboration across these projects
  • 19. Retrospect and Prospects ● The results are a qualified success ● But the patch was premature, ● Experience has shown that although the initial round of JDT modifications removed the biggest hurdles, – There are still many scenarios where Java source assumptions are made – The retrofitted public API maps JVM language constructs to the JDT's model in a way which best fits Java extensions rather than new languages
  • 20. Retrospect and Prospects ● More cross-language collaboration needed ● We need to draw on the experiences of the various groups and factor out common API and functionality ● We need to encourage other languages to follow, esp. languages not so close to Java ● We need to work with the JDT team to roll these changes into Eclipse
  • 21. Demo
  • 22. Find Out More ● Scala's home at EPFL http://www.scala-lang.org ● See also the scala-user and scala-tools mailing lists ● Scala IDE installation http://www.scala-lang.org/node/94 ● Update site for 2.8.0 Beta 1 http://www.scala-lang.org/ scala-eclipse-plugin-beta-preview
  • 23. Scala Support in Eclipse Monkey-patching the JDT for fun and profit? Miles Sabin, Chuusai Ltd. http://www.chuusai.com/ http://uk.linkedin.com/in/milessabin http://twitter.com/milessabin