Using git for an interactive video – Replay the JDT tutorial
Luckily, Ayush came up with an idea that enables all of you to go through the exercise all on your own: instead of creating zip files with various stages of the example projects, we pushed everything to github. I apologize to those who were overwhelmed by how we pushed git onto the tutorial participants in Reston.
Now, as EclipseCon is over, here’s what you can do:
- Fetch the slides: PDF or slideshare
- Clone the material for the plain JDT part (git: URL), containing two projects for the first two exercises.
- org.eclipsecon2012.jdt.tutorial1: traverse the Java Model starting from the element selected in the UI
- org.eclipsecon2012.jdt.quickFix1: implement a quickfix for adding a missing null check
- Clone the misc repo (git: URL), containing
- handouts: instructions for the exercises
- org.eclipsecon2012.jdt.populator: plug-in that was used in the tutorial to create sample content in the runtime workbench; show cases how to programmatically create Java files from String content
- Clone the OT repo (git: URL), containing
- AntiDemo: the OT/Equinox hello-world: prohibition of class names starting with “Foo”.
- Reachability: a full blown reachability analysis in < 300 LOC.
The last exercise, “Reachability”, we couldn’t even show in Reston, but luckily this is the most detailed repo: in 13+1 commits I recorded the individual steps of adding inter-procedural reachability analysis piggy-back on top of the JDT compiler. If you replay these commits from the git repo you can watch me creating this little plug-in from scratch. Starting from step 5 you’ll be able to see the results when you fire up a runtime workbench: the analysis will print to stdout what methods it found during each full build.
Look at the commit comments which summarize what I would have explained in demo mode. Still the material is pretty dense as it explains three technologies at the same time:
- How does this analysis work?
- What points in the JDT do we hook onto?
- How is the integration achieved using Object Teams.
Speaking of integration: using the “Binding Editor” you can see all bindings in a tabular view:
The right hand side of the table give the full list of JDT elements we connect to:
- classes that are extended using a role
- methods/fields that are accessed externally via a callout binding
- methods that are intercepted using a callin binding.
As a special bonus, step 14 in the git repo shows how to add problem markers for each unreachable method, so that the JDT will actually offer its existing quickfix for removing:
(Yep, both methods are detected as unreachable: calling each other without being called from another reachable method doesn’t help).
I hope you enjoy playing with the examples. For questions please use one of the forums: