Compiling Generics

Jacob Jennings <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
Hello, everyone. I just began using GCJ a short time ago, and I've
just run into a bit of a problem--most likely stemming from my lack of
knowledge about this compiler. In my Data Structures class, we program
a lot using generics, and I'd love to use GCJ, but when I attempt to
compile

public class ListNode<E> {
...
// blah blah, data members, constructors, methods, etc.
}

I get this error message:

ListNode.java:1: error: '{' expected.
public class ListNode<E> {
                        ^
ListNode.java:1: confused by earlier errors, bailing out

Now when I compile this same code into bytecode with the Sun SDK, then
compile the bytecode into machine code using GCJ, the compilation
succeeds, and the resulting binary works perfectly fine. I would like
to get away from using Sun's SDK unless I'm doing GUI programming. Is
there a compile-time flag I'm missing or something? The command I'm
trying to execute is "gcj -o LinkedQueue --main=LinkedQueue
ListNode.java Queue.java LinkedQueue.java". Thank you.

Jacob D. Jennings
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.