commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [csv] j2se1.3 compatibility / header line writer
Date Mon, 22 May 2006 15:52:51 GMT
OK, I see.

Whatever method is chosen, it's worth documenting the reasons for the
"strange" coding...

If a release is being built to support 1.3 and above, it might be
worth using the 1.3 compiler - or at least using the 1.3 jars.

S.
On 22/05/06, Martin van den Bemt <mllist@mvdb.net> wrote:
> That just works when compiling on jdk1.3 and will not work on jdk1.3 when compiled on
jdk1.4
> To prevent this, you specifically have to cast it to object to say "use the append which
takes an
> object" or as Nicolas suggested a toString(), but the last one is not my favorite solution..
>
> Mvgr,
> Martin
>
> sebb wrote:
> > On 22/05/06, Nicolas De Loof <nicolas.deloof@capgemini.com> wrote:
> >
> >>
> >>
> >> >> It is supported in jdk1.3.. Just cast the stringbuffer passed in to
> >> >> an object, so like
> >> >> StringBuffer.append((Object) StringBuffer)). Much more efficient than
> >> >> an if...
> >> >>
> >> >
> >> > Surely a StringBuffer is already an Object?
> >> >
> >> > Or am I missing something here?
> >> >
> >> StringBuffer has a new method in Java 1.4 to append another Stringbuffer
> >> without invoking it's toSring() method.
> >> Code that uses StringBuffer.append(stb) and compiled by a JDK 1.4 will
> >> not work on Java 1.3.
> >> I miself recommand Using  "StringBuffer.append(stb.toString())" that
> >> looks better than an apparently useless (Object) cast : checkstyle or
> >> IDE may warn for unecessary cast.
> >
> >
> > But that won't work so well on Java 1.4+.
> >
> > Can't one just use:
> >
> > sb1.append(sb2);
> >
> > for both 1.3 and 1.4, and let the method do the work as needed?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message