Tuesday, October 03, 2006

New JRuby Syntax for Importing Java Classes

We've added a cleaner, simpler syntax to JRuby for including Java classes into a given namespace. It stemmed from a response of mine to a user on the JRuby mailing lists, and has been committed to trunk already. Almost everyone on the list agreed this new syntax is better.

Tom sums up the history of JRuby's Java include syntax in his blog post, but here's the executive summary.

Where before you would use this:

include_class "java.util.ArrayList"
include_class("java.lang.String") { |p,n| "J" + n }

You now can simply do this:

ArrayList = java.util.ArrayList
JString = java.lang.String

And this syntax also works directly; no assignment to a constant is required:

class MyClass < java.awt.event.ActionListener
...
end

Pretty slick, if you ask me.

Ola Bini Joins JRuby Development Team

We're proud and excited to announce that Ola Bini has officially joined the JRuby development team. Ola has proven to be one of the most valuable community contributors to JRuby, and he's shown that he's dedicated to making Ruby on the JVM a reality. He's the sole creator of the RbYAML and JvYAML projects that have enabled high-performance YAML support in JRuby, he single-handedly implemented Enumerable in Java, he has been the primary developer behind our Zlib support, and he's contributed numerous patches and fixes over the past 8 months.

Thank you Ola for all your help, and welcome to the team!