Skip to main content

JSR-275 And why GeoTools does not care yet

Posted by jive on July 5, 2007 at 12:40 PM PDT

JSR-275 is almost ready! And there is much rejoicing to be had - but not quite yet.

In my last blog post I talked about GeoAPI and how we use it to define interfaces for a lot of the spatial goodness happening in the Java world. One of the constructs discussed was the interface for CoordinateReferenceSystem. This interface is implemented by a couple of projects:

Central to the idea of a CoordianteReferenceSystem is what unit of measure the numbers are in (meters, feet, sexidecimal degrees, etc...).

JSR-275 defines a really amazing concept of "Unit of Measure" (as described in Fowlers Analysis Patterns Book). This idea is powerful, and allows you all kinds of runtime safety checks so that you do not (in the proverbially case) mix up meters and feet and fly into Mars by accident.

In JSR-275 they broke out Java Generics system and made a lot of this goodness into something the compiler can check for.

So why doesn't GeoTools use JSR-275

Problem is the reference implementation (also provided by JScience) is Java 5 only :-) So for the moment GeoTools community is hanging back so we can work with all those Java 1.4 J2EE projects that pay the bills.

JSR-108 Where art thou

Actually the GeoTools project still uses a units-0.1.jar provided by the earlier JSR-108. This earlier JSR-108 was withdrawn - and that seems to have scared the voting parties.

From the JSR #275 Units Specification JSR Review Ballot:

On 2005-06-09 Sun Microsystems, Inc. voted No with the following comment:
Sun is voting "no" on this JSR based on concern over whether there
is broad need for this JSR and concern that this is essentially
equivalent to an earlier JSR (108) which was previously withdrawn.

It is possible that this topic may eventually benefit from a JSR.
However, it is not yet clear that there is broad Java community interest
in a Java standard in this space. There appeared to be only fairly
limited community interest in JSR-108.

I would like to suggest that the submitters continue investigating and
developing their API as a standalone class library. Once they have more
experience and can demonstrate broader community interest, it may be
appropriate to launch a JSR.
- Graham

There are a lot of very similar comments, even the positive votes call into question the existence of JSR-275 based on the perception of JSR-108 as a failure.

Why Units Matter

Please be assured that the concept of a unit system is vital to using Java for scientific purposes. Even the old JSR-108 code is in day to day use around the world - in my projects it is used to explain how the world is round.

Be assured JSR-275 would be an instant success if it was not battling a community that is still bound by Java 1.4. The availability of JSR-275 will be added motivation for us to upgrade. The value and utility of JSR-108 is also holding us back; be assured that when we do upgrade the reference implementation of JSR-275 will be test from all kinds of angles.

GeoTools and Java 5 - now is the Time

GeoTools is tabling a proposal right now about when to upgrade to Java 5. The success of JSR-275 on July 8th will be instrumental in this decision.

We will do our best to upgrade to JSR-275 - The only other thing you can do to help is is to kick websphere (and others) into releasing a proper Java EE implementation. You will find that the scientific community, much like the rest of Java, is splintered between versions.

Units with generics is great, it makes for a better example of Generics pulling their weight in the Java language than the usual example of Collections.