Problems with Serializable-String[] in 2.96

Pete Kelly ramsfanxxxiv@yahoo.com
Mon Sep 16 15:07:00 GMT 2002


I built version 3.2 and have a similar problem.  After
building and changing my path so it searches 
/usr/local/bin first it looks like version 3.2 is
used, i.e executing:

gcj -dumpversion 

results in 
3.2

I followed the installation instructions @
http://gcc.gnu.org/java/build-snapshot.html

I get the following when compiling the program below:

[root@PetesRedHat java]# gcj --main=example.TestSer -o
Test TestSer.class
example/TestSer.java: In class `example.TestSer':
example/TestSer.java: In method
`example.TestSer.main(java.lang.String[])':
example/TestSer.java:9: verification error at PC=52
example/TestSer.java:9: invalid argument type
example/TestSer.java:9: expected type
'java.io.Serializable' but stack
contains 'java.lang.String[]'
[root@PetesRedHat java]#


The following is source I am able to build with Sun's
jdk 1.1.8, but fails with gcj 3.2

package example;


import java.io.Serializable;


public class TestSer {

    public static void main (String[] args) {
        TestSer testSer = new TestSer();

        String[] values = {"one", "two","three",
"four","five", "six","seven"};
        testSer.printArgs((Serializable) values);
    }

    public void printArgs(Serializable values) {
        String[] strings = (String[]) values;
        for (int i=0; i<strings.length; i++) {
                System.out.println("value[" + i + "]: 
" + strings[i]);
        }
    }
}


Thanks for the help,

Pete




--- Jeff Sturm <jsturm@one-point.com> wrote:
> On Fri, 13 Sep 2002, Andrew Haley wrote:
> > Pete Kelly writes:
> >  > Thanks for testing and replying so quickly. 
> Sorry for
> >  > the "newbie" question, but do you recommend
> building
> >  > all of gcc or just gcj?
> >
> > You can't really build gcj on its own.  Build gcc
> with
> > "--enable-threads=posix".
> 
> But you don't need to build all languages;
> c,c++,java are the minimum for
> gcj, i.e.
> 
> <path-to-gcc-source>/configure
> --enable-languages=c++,java
> --enable-threads=posix
> 
> avoids building fortran, objc, ada, etc. frontends.
> 
> Jeff
> 




__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com



More information about the Java mailing list