A few months ago I started a new blog as somewhere to record general links and discussion of wider software development and other issues. As time has progressed, that blog has become very busy and a virtual centre for my blogging activity, leaving little time to manage this one. I have tried to run both this Stringtree development blog and the new one in parallel. This has proved problematic when posts are potentially appropriate to both.
For the last month or so I have tried the approach of automatically cross-posting Stringtree articles on both blogs, but this has resulted in some confusion and a potential splitting of comments. I no longer feel that this is a valid way to progress.
My plan, therefore is to “deprecate” this blog, and post all future Stringtree updates only on blog.punchbarrel.com. I would naturally hope that some of the other posts might also be of interest, but if you only wish to see Stringtree-related posts, you may view just that category.
At some point over the next few months I will ensure than all the existing posts from this blog are transferred to the new one, and disable comments etc. here. If you have subscribed to this blog using a feed reader or feed-converter, please update your subscription to http://blog.punchbarrel.com/feed/
I think the effort will be worth it. There are some exciting things planned for Stringtree software over the next year!
Thanks,
Frank.
Posted by Stringtree as General, Site News at 2:06 PM PDT
No Comments »
I’m cross. Very cross. Cross with Sun for releasing a new version of Java which shatters both backward- and forward- compatibility. Cross enough that I cannot see any sensible way of moving my software to Java 6 in the near future.
It all started with an innocuous question in a comment on my Punchbarrel blog. I had posted asking for opinions on a move to Java 5, potentially abandoning Java 1.4, for the core Stringtree codebase. The question in the comment was about skipping Java 5 and moving directly to Java 6. This would normally be too big a leap, but I replied that I would endeavour to continue my policy of ensuring my code works with as wide a range of Java versions as possible.
Then I actually tried to do it, and that’s what made me cross. The more I attempted to produce code which would compile and run on Java 1.4, Java 5 and Java 6, the more impossible it began to seem.
I was already aware of the first hurdle. Sun have added new methods to a lot of key JDBC interfaces by tagging them with the new javax.sql.Wrapper interface. This is actually relatively easy to fix in a compatible way. Just add two new methods to each class which implements one of the affected JDBC interfaces:
public boolean isWrapperFor(Class clz) {
return false;
}
public Object unwrap(Class clz) throws SQLException {
throw new SQLException("Not a Wrapper for " + clz);
} |
The actual method signatures in the Java 6 Wrapper interface are phrased in terms of Generics, but the above stripped version compiles fine using Java 1.4, Java 5 and Java 6 compiler and libraries.
However, even after adding these arguably pointless methods to all my concrete implementations of affected JDBC interfaces, I still had a bunch of compilation errors when using Java 6 libraries. And this is where Sun have really screwed up.
Several other key JDBC interfaces have also been extended. But this time it has not been done by anything as simple as tagging with a new interface. These interfaces have all gained extra method themselves. This should not be a deal-breaker. It should be feasible to just add implementations of these methods to the existing Java 1.4-compatible code. After all, any class is free to define any methods it likes, not just those from an interface.
Nope.
It is simply impossible to add these new methods to a class and have that class still compile in a Java 1.4 or Java 5 environment.
The reason is that these methods are themselves defined in terms of classes and interfaces which do not exist in earlier Java versions. For example, the java.sql.Connection interface gains methods referring to new interfaces NClob and SQLXML
There is no answer to this. Sun have broken backward and forward compatibility of JDBC in Java 6. It is no longer possible to write an implementation of several key JDBC interfaces in a way which compiles under all the most popular Java versions.
Once again, Sun completely misunderstands the real world. Not everyone is free to upgrade every deployment to the very latest Java version immediately it is released. Even within those who do manage to update all their machines in one go, not everyone can immediately drop real work to spend time messing with old code which should still work to bring it into line with a new fashion.
As I wrote at the start of this rant. I’m cross.
Grrr.
Posted by Frank as General at 10:36 AM PDT
No Comments »
A major goal of the Stringtree software project has always been to be as compatible as possible with all the software people are using for their Java development. Naturally that also includes whatever Java version is being used.
For a long time I interpreted this goal as implying that all Stringtree code should run on all Java versions from Java 1.2 onwards. Java 1.4, however, introduced some compelling new features including built-in regular-expression handling. For a few years I still tried to ensure that most code was still 1.2-compatible (for example by using Ant to swap in a third-party regular-expression library while building a jar file), while also providing a Java 1.4 version. Eventually, use of Java versions prior to 1.4 declined enough that I felt comfortable removing the complicated pre-1.4 version.
For the last few years I have been very careful to keep all my Stringtree code compatible with all versions of Java from 1.4 upwards. Now, however, the pressure is building again to move over to Java 5. In my day-to-day coding I develop with Java 5 and make increasing use of Java 5 features such as the enhanced for loop, the Iterable interface, enums, generics, autoboxing, varargs and so on. It would be very nice to be able to update the Stringtree codebase to use these features too.
Occasionally a Java 5-specific detail has crept in to a Stringtree library, and I have soon received comments or emails pointing this out. I haven’t noticed this for a while, which might indicate either that I have been especially careful, or that I there are no longer any/many people developing with Stringtree code who are still limited to Java 1.4.
If you are reading this and you still require Java 1.4 support, please let me know. Likewise, if you have thrown off the shackles of 1.4 within the last year or so or are desperately hoping for a Java 5 Stringtree that would be good to know too.
Is it time for Java 5 yet?
Posted by Stringtree as Friki, General, HTTPClient, Inkling, JSON, Mojasef, Projects, Templater at 7:59 PM PDT
No Comments »
I have experimented with Maven a few times, but never been particularly impressed.
Recently, however, one of my users has been bugging me to make the Stringtree and Mojasef classes and sources available in a Maven-style repository, for easier integration with Maven (or Maven-like) build tools and workflows. So I have done it. The current versions of key Stringtree and Mojasef files are now available from the Stringtree repository at the following URLs:
The Stringtree and Mojasef build scripts now include a “publish” target which uploads such artefacts to appropriate places in the repository, so future versions should continue to be available.
This is the first time I have done this, so I would welcome comments from any readers who actually use Maven (or buildr, or anything else which supports this repository format). In particular, I am interested in opinions on whether it is OK to simply replace artefacts with the same names and locations for minor tweaks and bug-fixes, or whether even the smallest change should result in the generation and upload of a new version with a new name and location.
Posted by Stringtree as General, Projects at 11:48 AM PST
1 Comment »
It’s been a month or so, so it’s time for another release of Stringtree. Changes in this release include:
- fixed some broken EasyTemplater constructors
- added switchable prefixing of attributes in XMLReader
- added switchable forcing all values to lists in XMLReader
- added storing cdata from mixed elements as “text()” in XMLReader
- added extra “read” methods to JSONReader to allow calling with a CharacterIterator
- XMLReader now skips a DOCTYPE without complaining.
- tests.Hierarchy renamed to tests.tree
- small tidyup of object creation to allow reference to context items instead of full class+parameter specifications
- support a naive view of namespaces in XML parser, include colonprefix in the name
- some slight improvements to class creation stuff in util to better deal with multiple calls to “init”.
- added a GUID generator for use in REST-style applications
Download available from Sourceforge as usual
Posted by Stringtree as General, Projects at 11:12 AM PDT
4 Comments »
I just had a pleasant email exchange with someone who is interested in embedding Stringtree JSON in another project. In this particular case, the basic functionality of the JSONReader is fine, but the calling API was not quite aligned with what they need.
So now, as well as reading JSON from a String, you now have the ability to read JSON from a CharacterIterator. This was a neat changes, as Stringtree JSONReader uses a CharacterIterator internally anyway, so the extra method actually does a bit less than the original one.
For “power users”, there is actually an extra method. When JSONReader starts reading from a CharacterIterator it’s not entirely clear whether it should get its first character by calling current() to get a character already read once, or by calling next() to get the next unread character, or by calling first() to get the first character of the sequence. With this in mind I have provided a read(CharacterIterator ci, int start), where start can be JSONReader.START, JSONReader.NEXT, or JSONReader.CURRENT.
This update is available in sourceforge subversion, and will be included in the next release of Stringtree and Stringtree JSON.
Posted by Stringtree as General, JSON, Projects at 10:52 PM PDT
2 Comments »