The Source for Java Technology Collaboration
User: Password:



Tim Boudreau's Blog

Tim Boudreau Tim Boudreau had his first startup when he was 13, and has been hooked since, with brief departures to play rock and roll, write and play music and do graphics and photography. He is the coauthor of NetBeans, the Definitive Guide from O'Reilly and Associates. Tim was part of the team that open sourced NetBeans, Sun Microsystems' Java(tm) development environment, and currently work as a developer on that project. Originally from Massachusetts, he lives in his adopted home city, Prague, Czech Republic.



What technology evangelists really do for a living

Posted by timboudreau on April 11, 2008 at 08:21 AM | Permalink | Comments (1)

We shot some video on our recent whirlwind tour of South America. This fun video shows one of our adventures. What do technology evangelists really do for a living? Ride in taxis and buses, of course!

BTW, the video editing and post-production was done by my good friend and music buddy Doug Finn (douglas dot finn at gmail). He is a supremely talented video editor, actor, director and musician. If you're looking for something like this, I highly recommend him.

A couple of other videos from this trip (less slickly edited, since it was me doing them not Doug) are visible at the bottom of this page on netbeans.tv.

The person I really feel for in the above video is Juan Daniel Perez, whose reward for helping organize our event in Cordoba was that five guys piled into his hotel room at 6:30 in the morning to use his shower :-)

See Java code the way javac sees it

Posted by timboudreau on February 28, 2008 at 03:50 PM | Permalink | Comments (23)

I wrote a small Swing app to browse javac's abstract syntax trees (ASTs) of source code. If you've ever wanted to write a tool that analyzes Java source code, it is a big help for understanding the Javac tree API.

Last spring I set about learning javac's Tree API (JSR 199) - NetBeans uses it internally as its parser for Java source code. It has a bit of a learning curve, and contains lots of this-tree and that-tree interfaces for different types of structures in Java source code. So to help me develop an intuitive understanding of what all of these classes map to, I wrote a tool - a standalone Swing app that lets you open a Java source file and then browse its AST.

syntaxtreebrowser.jpg

The tree on the left lets you drill through the syntax tree itself. The middle pane shows you the object that is selected, and a tree of all of its fields and methods via introspection, which you can drill as deeply as you want through. The right pane is sensitive to selection in whichever of the other two panes has focus. The top half shows you the list of all types the selected object implements (and boldfaces those that are part of the official API), and the bottom half shows you the value of toString() for the selected object (if it's part of the syntax tree, it will be the source code text).

I found it very useful, and still use it to figure out just how to hunt down a particular thing I want to find in source code. Hopefully it will inspire some others to play with javac as well. It requires JDK 6. You can download the JAR file here and just run it with java -jar.

The source code is available in NetBeans CVS under contrib/SyntaxTreeNavigator (everything was reorganized for the recent migration to Mercurial, and I haven't figured out where it is in the new source structure yet).Update (3/31/08): I've set up a java.net project for the source code, syntaxtreebrowser.dev.java.net. It is pending approval but it should be publicly visible in a few days.

Caveats: (updated 2/29/07)

  1. To use the application, you will need javac on your classpath. If you are running Apple's JDK 1.6 it already is. For other platforms you may need to run with -Xbootclasspath/p:/PATH/TO/javac.jar (may be in tools.jar).
  2. This application uses the com.sun.source.tree API from javac. If you are not running Sun's javac, this package will probably not be there.

I have updated the JAR file to produce better diagnostic information, and added a source zip file.

Class visualization module for NetBeans

Posted by timboudreau on February 28, 2008 at 02:13 PM | Permalink | Comments (0)

Last week I wrote a little module that uses the NetBeans Visual Library and the Javac Tree API to create a graph of the contents of a Java file, showing dependencies between class members. It's now available on the NetBeans daily build update center - if you're running a daily build of NetBeans, just go to Tools | Plugins and download Graphical Class Viewer.

My question is, would anybody actually find this useful? It was mostly an experiment to get more fluent with a couple of APIs I need to know well - but it seems like it could be handy if you're going to edit a class you didn't write and want to see where the action is - or if you've got a bunch of encapsulated fields and want to quickly see if anything is not using the getters and setters.

What it does:
  • Shows a graph (see screenshot below)
  • If you hover the mouse over, say, a method, then the path to things that method calls/uses will be shown in red, and things that call that method are shown in blue
  • You can click the arrow button on the widget for any class member and see its source code

Feel free to try it out and let me know if you think it's something worth putting more work into.

Also, if anyone knows of any speedy and good hub-and-spoke or other layout algorithms for the case where you have n nodes each of which can have up to n-1 connections to other nodes, feel free to let me know - what it does now is less than optimal. At some point I may think through the geometry to do it nicely, but I'm not sure when.

The sources are in NetBeans contrib mercurial repository.

Comments? Reply on the NetBeans DZone thread about it.

May 2008
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31


Search this blog:
  

Categories
Business
Community
Community: Java Enterprise
Community: Java Patterns
Community: Java Tools
Community: JavaDesktop
Community: NetBeans
J2EE
J2ME
J2SE
Jini
Open Source
Programming
Swing
Tools
Web Applications
Archives

April 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
February 2007
January 2007
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
April 2005
March 2005
February 2005
January 2005
December 2004
September 2004

Recent Entries

What technology evangelists really do for a living

See Java code the way javac sees it

Class visualization module for NetBeans



Powered by
Movable Type 3.01D


 Feed java.net RSS Feeds