[Biojava-l] tiny problem with converting java 1.5 to 1.4

Dr. Christoph Gille christoph.gille at charite.de
Fri Jan 6 15:37:46 EST 2006


Recently I discussed that Biojava could be changed to Java version
1.5 without breaking compatibility since the novel tool Retroweaver
allows to run Java 1.5 programs on older JREs.

I started to use enums in my program and did not encounter any
problems related to retroweaving.

However there is one nasty problem  which shows up only at runtime:

In Java 1.5 but not in 1.4 exists the method
StringBuffer#insert(int, CharSequence)

In Java 1.4 and 1.5 exists the method.
StringBuffer#insert(int, Object)

After compiling with the javac version 1.5 and retroweaving
one gets a  NoSuchMethodError runtime error because
#insert(int, CharSequence) does not exist in the 1.4 runtime library.

The workaround is simple - just casting StringBuffer to Object so that
the method #insert(int, Object) is taken instead of #insert(int,
CharSequence).

I already told the author of retroweaver.
Otherwise retroweaver works very well.




More information about the Biojava-l mailing list