This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Problems with Serializable-String[] in 2.96
- From: Pete Kelly <ramsfanxxxiv at yahoo dot com>
- To: java at gcc dot gnu dot org
- Date: Fri, 13 Sep 2002 10:11:56 -0700 (PDT)
- Subject: Problems with Serializable-String[] in 2.96
I am unable to build the code below with gcj from
RedHat 7.3 (gcj version 2.96).
It appears there is a problem with using a String[]
when the method signature specifies a paramenter of
type java.io.Serializable. The compiler returns with
"unexpected type on stack" error on first line of
method as well as the line that has the method
invocation:
example/Implementor.java:11: unexpected type on stack
example/Implementor.java:23: unexpected type on stack
Is/was this a known issue? Has it been corrected in
latest version of gcj? Can I install latest version
of gcj without building all of gcc?
Thanks in advance,
Pete
Here is the source:
package example;
import java.io.Serializable;
public class Implementor {
private int count_;
public static void main (String[] args) {
Implementor imp = new Implementor();
if (args.length < 1) {
System.out.println("No arguments, test
sending array of Strings to setCount()...");
String[][] values = {
{"one", "two"},
{"three", "four"},
{"five", "six"},
{"seven", "eight"},
{"nine", "ten"}
};
imp.setCount(values);
}
else {
for (int i = 0; i < args.length; i++) {
System.out.println("args[" + i + "]:
" + args[i]);
imp.setCount(args[i]);
}
}
}
public int getCount() {
return count_;
}
public void setCount(Serializable count) {
if (count instanceof String) {
count_ = Integer.parseInt((String) count);
System.out.println("count_ now is: " +
count_);
}
else // hande as array of Strings
{
String[][] values = (String[][]) count;
for (int i=0; i<values.length; i++) {
for (int j=0; j<values[i].length; j++)
{
System.out.println("count[" + i +
"][" + j + "]: " + values[i][j]);
}
}
}
}
}
__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com