Jeremy Rayner on java and other stuff.

All | AudioDrama | Chatter | Fun | Groovy | Java | Life

Java SE 7 (preview)
Posted on 20 Mar 2009
I went to the Sun UK Developer Update on 19 Mar 2009 and this is what Simon Ritter had to say about...
Java SE 7

Java SE 7 has been a long time coming, partly due to the distractions of open sourcing Java and engineering efforts on Java FX, but it is now due out beginning/early 2010.

Fewer features are better as potential features have to be weighed up against the constraints of future expansion of the language and compatibility with the abstract model of Java.

What will be in Java SE 7 (subject to change)

  • JSR tbd - Small language changes (see below)
  • JSR 294 - Language and VM changes to improved modularity support (see below)
  • JSR 292 - Supporting Dynamically Typed Languages (can give up to 10 times speed increase for dynamic languages, but will now not include any new bytecode)
  • JSR 203 - More New I/O APIs including native filesystem access
  • java.nio.file package - FileSystem, FileRef, Path
  • JSR 296 - a simple application framework for Swing applications
  • SCTP - Stream Control Transport Protocol
  • SDP - Session Description Protocol
  • Changes to the class loader architecture
  • Unicode 5.0 support
  • new Date Picker in Swing
  • JSR 166y - lightweight concurrent task framework known as ForkJoin java.util.concurrent.forkjoin package
The main two features to write home about though appear to be...
  • JSR 294 - Language and VM changes to improved modularity support
  • The new module system will allow a way for the very old deprecated methods to go.
    • JSR 277 Java Module System (JAM) - Sun will be discontinuing their input to this JSR
    • JSR 294 Language extensions in support of information hiding and separate compilation - Sun looking to get this JSR going
    • Simon Ritter also mentioned Project Jigsaw and OSGi, all of which is much better explained here
  • JSR tbd - Small language changes
    • If a caught exception is declared final, it is safe to rethrow any caught exception. Because the catch parameter is final, it can only hold exceptions that are thrown from the try block.
      try {
      } catch (final Throwable t) {
        throw t;
    • Multicatch - Support catch clauses that catch multiple exception types
      } catch (Exception1, Exception2 ex) {
        throw ex;
    • Null dereference operator (?.)
      if (a!=null) {
    • Syntax sugar for Generics
      Map<String, BigDecimal> = new HashMap<String, BigDecimal>();
      Map<String, BigDecimal> = new HashMap<>();
    • JSR 308 - type annotations
      List<@NonNull String> strongList;
    • Concurrency and collections updates
The following items are not going to be in Java SE 7
20 Mar 2009 |
London Puzzle Party
Posted on 04 Oct 2007

I went along to the London Puzzle Party at Camden Lock last night, which is an event run, once a month, by the wonderful little shop full of mechanical puzzles called Village Games.

I've never been along to these before, but I guessed I might like the community, after all I look with envy at the Gathering for Gardner and Burning Man events in the USA.

I arrived at the shop in Camden, to be greeted by Ray the owner, he very kindly showed me some of the most popular puzzles and took me on a tour of the books. Ray tells me that he cannot compete with the likes of ebay and amazon on the books, and therefore is not going to restock any of the shelves with books when these ones disappear.

Ray showed me where the evening event was taking place, and I took my place at the table.

Martin very kindly introduced me to all the people round the table, and he explained that his passion was the sliding block puzzles. Martin has some amazing pictures of his collection online.

Fred arrived soon afterwards, with his pockets full to bursting with little wooden blocks in odd configurations, his passions are the cube puzzles and number theory. (R.I.P.)

The owner of Grand Illusions shop arrived next, his name is Tim and he travels the world in search of interesting gadgets. This evening he had brought along

  • a yo-yo in the shape of a cone
  • a device that gives you the impression your eyes are over 10 inches apart
  • a smooth mirror, which when a light is shone upon it, reflects a picture onto the wall

Robert is the resident genius, he is a wonderful 81 year old chap who hasn't missed a single one of these events.

David Wells was there, author of some of my favourite books, I showed him a wonderful little thing on knot multiplication

Simon who is the resident Go expert talked to me about the London Open and a possible get together for kids who liked the game. When pressed, Simon recommended a book called In the Beginning which will have to be sought out.

I sat for most of the evening scratching my head over various interlocking 3-d puzzles that were thrust into my hand, I think I solved about 2/3 of them, but I wouldn't want to be in a competition against any of these chaps.

When time was finally called, I was accompanied back to the station by Frank, who explained to me that his passion was impossible objects. One of his favourites is the corkscrew opener (with cork) inside a bottle, as these objects go naturally together.

Suprisingly though, it isn't the puzzles themselves that seem to light up this room, it is the interest they all have in other people, how they solve the puzzles, what alternative solutions they might give, and any new ideas.

Thanks to Ray for organising this event, it was great fun, I recommend it highly to anyone who enjoys Recreational Mathematics and Puzzles.

04 Oct 2007 |

Lightning Groovy
Posted on 25 May 2007

My 6 minute elevator pitch for the Groovy language.

Recorded at Google offices in London on 24 May 2007,
as part of the Open Source Code Jam 3

 Presented and Edited by me ( Jeremy Rayner )

25 May 2007 |

Groovy at JavaOne 2007
Posted on 14 May 2007
Here is a round up of bloggers feedback about Groovy from JavaOne2007
Bernard Ng
Ben Teese [1], [2]
Charles Ditzel [1], [2]
Michael Kovacs
Andres Almiray [1], [2]
Peter Pilgrim
Chirag Mehta
Matt Stine [1], [2], [3]
Jason [1], [2]
Maryland Pok Guy
Lucas Jellema [1], [2]
Michael Yuan
Antoni Batchelli
Keyur Shah
Cameron Purdy
Frank Coyle
Igor Minar
Brendon Humphreys

Ola Bini [1], [2]
Cay Horstmann [1], [2], [3]
Hani Suleiman
Geertjan Wielenga (Netbeans plugin)
Graeme Rocher [1], [2], [3], [4] (Grails Lead)
Jason Rudolph [1] [2] [3]
Ian Roughley (InfoQ)
Cedric Beust + comments
Danno Ferrin
Ron Hitchens
Steve Giovannetti
It looks like we managed to enthuse some people about Groovy and we even made it to the best seller list (#5)

Special thanks to Guillaume Laforge, Dierk König, Rod Cope, Vladimir Vivien Graeme Rocher and anyone else who talked about Groovy at JavaOne, either on stage, or in the corridors. Nice one.

14 May 2007 |

Third Groovy Developers Conference
Posted on 01 Feb 2007
01 Feb 2007 |

Groovy 1.0 released!
Posted on 03 Jan 2007
Groovy 1.0 has finally been released.

It has been a long road, lasting over three years, but at last I can recommend Groovy as a stable, production proven and well documented programming language for the Java platform. (not to mention a very helpful and large user community)

This release coincides with the launch of the Manning book Groovy in Action, which gives an in depth reference to Groovy 1.0

[Full Disclosure: I'm a core committer for Groovy and I was a technical reviewer for this book]

Groovy 1.0 Highlights:

  • A formal syntax based closely on Java 1.5, with added Groovy bits.
  • Groovy can easily run source from the command line, ant, embedded in code
        (simply place groovy-all-1.0.jar in your classpath)
  • Close ties with Spring, Lucene and other real world Java products.
  • Fantastic for reducing the verbosity of common tasks in Java

quick start: example installation to /usr/local

$ cd /usr/local
$ wget
$ tar xvfz groovy-1.0.tar.gz
$ export GROOVY_HOME=/usr/local/groovy-1.0
$ export PATH=${GROOVY_HOME}/bin:$PATH
$ groovy -e "println 'hello world'"

To coincide with this release, I have also released version 0.0.2 of the JVM command line interpreter Grash.

I'll be giving a Talk about the Groovy Compiler on 25 Jan 2007 in London, please come along to that, and the pub afterwards, to discuss all things Groovy.

I will be at the Groovy Developers Conference in Paris (starts 29 Jan 2007) to discuss the future direction of Groovy, in particular enhanced IDE support.

In May 2007 there will be a three day Groovy and Grails conference at the Barbican, which will be perfect for anyone interested in this language to meet the core developers, and discover the cutting edge progress in Groovy.

But most of all, Groovy 1.0 would not be where it is today without the work of the open source community. I'd like to thank each person for their work in making Groovy a fantastic language:
Guillaume Laforge (glaforge), Jochen Theodorou (blackdrag), Jeremy Rayner (jez), John Wilson (tug), Russel Winder (russel), James Strachan (jstrachan), Dierk Koenig (dierk), Christian Stein (cstein), Paul King (paulk), Joe Walnes (joe), Chris Stevenson (skizz), Jamie McCrindle (jamiemc), Matt Foemmel (mattf), Sam Pullara (spullara), Kasper Nielsen (kasper), Travis Kay (travis), Zohar Melamed (zohar), Bob McWhirter (bob), Chris Poirier (cpoirier), Christiaan ten Klooster (ckl), Steve Goetze (goetze), Bing Ran (bran), John Stump (jstump), Pilho Kim (phk), Mark Chu-Carroll (markcc), Alan Green (alang), Edward Povazan (emp), Franck Rasolo (fraz), John Rose (jrose), Graeme Rocher (graeme), Guillaume Alleon (galleon), Antti Karanta (akaranta), Dave Kerber (davekerber), Hein Meling (hmeling), Joachim Baumann (jbaumann), James E. Ervin (jervin), Scott Hickey (jshickey), Martin C. Martin (mcspanky), Marc Guillemot (mguillem), Aslak Hellesoy (rinkrank), Steven Devijver (sdevijver), Scott Stirling (sstirling), Yuri Schimke (yuri)
Joern Eyrich, Robert Kuzelj, Rod Cope, James Birchfield, Robert Fuller, Sergey Udovenko Hallvard Traetteberg, Peter Reilly, Brian McCallister Richard Monson-Haefel, Brian Larson, Artur Biesiadowski Ivan Z. Ganza, Arjun Nayyar, Mark Turansky, Jean-Louis Berliet, Graham Miller, Marc Palmer, Tugdual Grall, and many many many other contributors and organisations.

Thankyou All (and apologies if I missed anyone, so many people...) :-)

P.S. an improved java2groovy is now in the core distribution of groovy 1.0 :-)

03 Jan 2007 |

Posted on 29 Dec 2006
Having just finished the first full run through of a groovy pretty printer, I thought I'd flex it's muscles by creating a useful command line program...
 java2groovy [file ...]

    The java2groovy tool reads class and interface definitions, written in the
    Java programming language, and converts them into groovy source files.
to do this...
  • I took the original java.g grammar which groovy.g is based upon
  • amended it to remove Java features not implemented in groovy.g ("do" keyword, Array Initialisers etc)
  • Created a Java2GroovyMain which takes Java files and parses into a Java like source AST
  • Converted the Java like source AST into a one for one Groovy equivalant
  • Applied a Groovifier, which applies common simplification tasks to the AST (e.g. don't need public keyword if you have other modifiers)
  • Then the resultant groovy AST is output using the "pretty printer"
(not in subversion yet RC3? post 1.0?)

So... job done, what's next :-)

Seriously though...

  • java.g needs to be amended some more to use create() instead of #[], otherwise line/col nums are lost
  • is an interesting step, lots of tiny refactorings, at the source AST level, very powerful...
    // (e.g. don't need public keyword if you have other modifiers)
    if (t.getType() == MODIFIERS) {
       GroovySourceAST publicNode = t.childOfType(LITERAL_public);
           if (t.getNumberOfChildren() > 1 && publicNode != null) {
           // has more than one modifier, and one of them is public
               // delete 'public' node
  • some minor changes to things like string literals (get a double double-quote each time at mo...)
  • all pretty printer issues apply (no comments on AST etc)
java2groovy is now included in Groovy 1.0 (download here)
(very very beta) NO DOCS, NO WARRANTIES etc etc

Oh yes... a sample...

$ java2groovy src/test/groovy/lang/

 Automatically Converted from Java Source

 by java2groovy v0.0.1   Copyright Jeremy Rayner 2007

 'java2groovy' cannot be used to convert one working program into another

package groovy.lang
class MockWriter


   private String output

   String getOutput() {
       String answer = output
       output = null
       return answer

   void setOutput(String
        output) {

   void println() {

   void println(Object
        object) {
       setOutput(""println("" + object + "")"")

   void print(Object
        object) {
       setOutput(""print("" + object + "")"")
29 Dec 2006 |

Tech Presentations for your ipod
Posted on 19 Sep 2006
Some excellent presentations to watch online or on your ipod
19 Sep 2006 |

Useful Java Stuff
Posted on 06 Jul 2006
Useful stuff
  • stomp is a cute protocol for working with messaging systems.
  • compass is an object-searchengine mapping tool, making lucene easier.
  • Many people suggest it is time to switch to subversion instead of cvs.
  • Also Trac is recommended for a project workbench, looks cool.
  • JAX-WS is the spec for Java and web services
  • JAXB 2.0 looks interesting [overview (old)]
  • but I still love XStream
  • JPA (Java Persistence API) is hot [walkthrough] and worth learning.
  • JPA is implemented by the FREE Oracle tool Toplink
  • as well as Open JPA which is based on the wonderful Kodo.
  • Jencks is a good implementation of JCA
  • Spring was of course implicitly wonderful, and Pitchfork appears to be adding EJB3 to Spring.
  • Glassfish is incubating lots of interesting side projects.
06 Jul 2006 |

Second Groovy Conference
Posted on 28 Nov 2005

Starting out on a chilly November morning, with just a Burger King breakfast for company, I found myself checking in for the Eurostar to Paris. I boarded the train, and found I had two hours of my own time (a rare thing these days) and therefore decided to bring some of my projects up to speed with the latest Groovy release (JSR-04)

First off was my pet wiki server called biscuit, which was a simple affair needing changes only to variables not initialized with a type or the 'def' keyword. As I finish this task before arriving at the channel tunnel I decided to sink my teeth into a meatier topic, and look into providing tab completion for my Groovy shell called grash. The excellent jline library hooks for completion, so I quickly hook this up to the 'ls' function in grash and feel great as I navigate my object tree using the same nifty functionality I know in my favourite unix shells.
I then started bringing grash up to the latest Groovy release, but after the initial 'def' updates, I quickly realise that something else is afoot. It appears that providing user defined commands and attaching them to objects has broken. A quick debugging session shows that for some reason the GroovyClassLoader is being told to load two versions of the reflector for the same script.
At this point I get a phone call from James Strachan, it appears that he caught the train by the skin of his teeth, and after fighting his way down the carriages we meetup, just as we pull into Paris.

As we stand in the queue for the taxis, James and myself discuss the xbean project and how to best integrate Groovy closures into Springs template callback mechanisms. In order to prevent writing wrapper classes over the top of every spring template, James suggests adding functionality to groovy to allow single method interfaces to be automatically implemented by Closures, in much the same way as Listeners are implementable by Closures today. As James pulls out his laptop and starts showing me where these hooks would reside, I can tell that this is going to be a good JSR meeting, and one which would justify using two days of my own holiday and the excessive eurostar fares which I paid for.

We arrive, after a hairy taxi ride around the 'Arc de Triumphe' at the Sun offices in Paris. Guillaume excitedly takes us up to the 'Jupiter' room on the third floor, where I finally get to meet blackdrag, our debugger extraordinaire, and Dierk who has been writing Groovy in Action. We are delighted to find that Sun have provided an internet connection, and Guillaume has already uploaded photos to flickr for the watching world to see.

Having missed the morning session due to our travel, we are quickly brought up to speed. Finally we will get to talk about name resolution and scoping. The topic for the first day appears to be name resolution, with most of the discussion centring around how best to cope with vanilla names.

After a lunch paid for, very kindly, by Dierk, the discussion soon turns into a heated debate over the treatment of vanilla names.

class MyScript {
  String toString(){
    return "foo"

  void run() {
      // does this call MyScript.toString() or myList.toString() ?
I believe that... Tug argues the enclosing object instance should listen for and consume names prior to the lexical scope. (i.e. above example would call myList.toString())
James argues that the default should be lexically bound to the current context (i.e. above example would call myScript.toString()), and if the object instance was needed to be referred to that some form of syntax could be constructed to allow this, e.g. $toString() would be a dynamic name that could be interpreted differently.
At least, with my laptop pointing at the wiki, and up on the projector, I ensure that the examples and minutes are being captured in the wiki and not on the whiteboard.

We appear not to reach a resolution as Vincent Massol arrives to bring us to the Chinese restaurant for the evening. We all potter down to the Metro, Guillaume and tug have kindly arranged metro tickets for us delegates too laden with bags, and soon we arrive across town. There we meet Xwiki's Ludovic Dubost and Erwan Arzur and Benjamin Mestrallet from eXoPlatform.

A very entertaining evening ensues, with chatter ranging from XWiki through to 'flaming drunk prawns', and we all end up at Ludovics apartment nearby, where Erwan introduces us to a bottle of Calvados that he had stowed away for such occasions. At about 12:30 we stumble back on the last metro and finally check in to our sleepy hotel. I feel glad to find a towel in the room, and settle down to a restless Parisian slumber. (thanks so much to Bob at Codehaus for funding the room)

I awake 5 hours later to the sound of my Blackberry playing 'The Entertainer', and discover the delights of hot chocolate for breakfast (no sign of tea, I think coffee is more popular here). We stumble back to the Sun offices, again Guillaume and tug have the metro sorted.

Day Two starts out more productive, with discussion about opening up the DefaultGroovyMethods for the layman and we get some agreement about the 'use' keyword and my 'enhances' proposal. However the discussion soon gets round to the topic of Builders (a.k.a. Markup) and again the name resolution and scoping bear comes up to bite us again.

We have Tug and Guillaume firmly on the side of Builders being in charge of everything defined within the markup delimiters. James argues that markup is fundamentally broken and some kind of syntactic clue that we are suddenly entering a different 'markup world' where normal resolution and scoping doesn't apply. For some reason, that I cannot fathom, Tug and Guillaume both seem vehemently opposed to any indication in the code that we are in a Builder section. This includes both the suggestion of a 'with' keyword or .{ notation to indicate to the reader of the code that something different is about to occur.

String toString() {
  return "foo"
swingBuilder.frame() {
  panel() {
We were all fairly happy that the Builder could be responsible for name resolution inside it's own block (e.g. the swingBuilder instance would be responsible for how it treats toString() inside), but what seemed to really be a sticking point was the important fact that due to the dynamic nature of the name resolution/scoping within this block, some visual clue to the reader of the program was necessary.
James argued for, and I agree that, the use of some kind of syntactic indication was vital to ensure that the Groovy language was sane, predictable and maintainable. The above example would look something like this... (note the .{ syntax indicating a different lexical construct)
  panel() {
or the even clearer...
with (swingBuilder.frame()) {
  panel() {
Thus implying to any compiler, IDE, or human reader that the block of code was not a true lexical closure, but some other construct which was dynamic in it's very nature, and thus warnings, code completion and everything else specification related did not apply, as the responsibility would lie with the implementation of the builder.
I'm sad to report that no agreement was reached on this matter. Not so much which syntax would be useful, but actually whether we should have any syntax denoting the difference between a true lexical Closure and one of these Builder blocks. The historical reasons go back to Builder blocks looking just like Closures, and I'm afraid this long standing mistake must be removed from the language before any true progress can be made, as no sensible specification rules can be applied while the dichotomy exists.
I headed back to London with a very disappointed James Strachan, the language which has some of the finest minds, and most exciting ideas now faces a pivotal point in its life, and I'll do everything I can to ensure that clarity over dynamism wins the day.

My many thanks go to Guillaume for the meeting arrangements, to Sun for the facilities, to XWiki,eXoPlatform and Vincent Massol for the Chinese, Dierk for the Lunch, and Bob/GoogleAds for the hotel room.

28 Nov 2005 |

Posted on 14 Sep 2005
The object of the puzzle is to figure out which of the squares should be coloured in to make up a picture, which is the solution to the puzzle.
print out and solve this puzzle
  here is a more difficult one
  • Numbers by each row or column form a 'clue'
  • Each clue tells you how many solid blocks there are on that column or row, how big they are, and in what order they appear
  • There must be at least one gap between two blocks
For example: A clue of "3,1" tells you there is a block of 3 consecutive solid squares on this row, and to the right of it is a single block of 1 solid square.
[more info]
Nonograms (a.k.a. Griddlers) in their current form, have a history going back about 20 years.

The theory behind these puzzles can get quite involved, and provides an interesting exercise in programming. Steven Simpson has provided some interesting nonogram solvers

There are also some interesting variants on this puzzle too.

More nonograms to play with are here, here and here.

update: Here is a nice tutorial on how to solve these puzzles.

14 Sep 2005 |


October 2007
  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
Prev | Today | Next

rss:subscribe (All)

What I'm reading
my feed aggregator ->box

My websites
London Java Meetups
Programming Projects
Elite in Java
Jez's Photos
Fantasy Stock Market
Cool Saxophonist
Doctor Who Audios
Pisces Audios

Other Blogs
Mike Cannon-Brookes
James Strachan
Joe Walnes
Sam Dalton
Simon Brown
Cameron Purdy
Mike Roberts
Erik C. Thauvin
John Martin
Manfred Riem

B5 d++ t++ k s+ u- f
i+ o+ x-- e+ l- c--

powered by blogmento