copile java 1.5 code

Andrew John Hughes gnu_andrew@member.fsf.org
Wed Jan 26 16:23:00 GMT 2005


On Wed, 2005-01-26 at 14:26, Michael Koch wrote:
> Am Mittwoch, 26. Januar 2005 15:13 schrieb Tim Oliver Wagner:
> > Hello,
> > I need to compile a java program. This one is written with java
> > 1.5. It does not work to compile the program correct.
> >
> > I wrote a little program to solve my compile problems, but it still
> > doesn't work. I hope someone can help me. Or is it just at the
> > moment not possible to compile java 1.5 code?
> >
> > The little senseless program is append to this mail.
> 
> java.lang.StringBuilder was added in JDK 1.5 and we don't added that 
> to GCJ yet.
> 
> 
> Michael 

The class Test.java uses a parametrically-typed list (List<String>) and
so will not compile with gcj or any other pre-1.5 compiler (including
previous versions of Sun's compiler).  It will compile with javac or ecj
(including against the generics branch of GNU Classpath).

As for running the class, Test.class works just fine, including with gcj
3.4.  Test2 uses the concatenation operator, '+', which requires the
existence of java.lang.StringBuilder, as 1.5 compilers use this new
class to perform this operation.  This is in GNU Classpath, so you can
either wait for it to be merged to gcj, or, alternatively, alter the
class to perform concatenation differently (for example, explicitly
using java.lang.StringBuffer).  
-- 
Andrew :-)

Please avoid sending me Microsoft Office (e.g. Word, PowerPoint) attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

No software patents in Europe -- http://nosoftwarepatents.com

"Value your freedom, or you will lose it, teaches history.
`Don't bother us with politics' respond those who don't want to learn."
-- Richard Stallman

"We've all been part of the biggest beta test the world has ever known --
Windows"
-- Victor Wheatman, Gartner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/java/attachments/20050126/da29f3e3/attachment.sig>


More information about the Java mailing list