[498] in java-interest

home help back first fref pref prev next nref lref last post

Problem: Assignments in Argumentlists

daemon@ATHENA.MIT.EDU (Fritz Hohl)
Mon Jun 26 11:23:40 1995

From: Fritz Hohl <hohlfz@bass.informatik.uni-stuttgart.de>
Date: Mon, 26 Jun 1995 16:23:36 +0200
To: java-interest@java.sun.com

Hi!

I've got a problem with a programm, which is, IMHO, correct.
Is it possible that there's a bug in the compiler?


This program is compiled without problems:
----------------------------------------------------
// PersistenceManager Object File Version: 1.0 (26.6.95)
public class Pm1
  extends Object {
  static public Object inhalt[] = new Object[2];
  static public int zaehler = 0;

public Object clone() {
  zaehler++;
  return(inhalt[zaehler - 1]);
}

static public Object[] paObject5d1(Object p0,Object p1,Object p2,Object p3,Object p4) {
Object o[] = new Object[5];
  o[0] = p0;
  o[1] = p1;
  o[2] = p2;
  o[3] = p3;
  o[4] = p4;
  return(o);
}
static public int[][] paint5d2(int p0[],int p1[],int p2[],int p3[],int p4[]) {
int o[][] = new int[5][];
  o[0] = p0;
  o[1] = p1;
  o[2] = p2;
  o[3] = p3;
  o[4] = p4;
  return(o);
}
static public int[] paint3d1(int p0,int p1,int p2) {
int o[] = new int[3];
  o[0] = p0;
  o[1] = p1;
  o[2] = p2;
  return(o);
}
static {
  Object tn[] = new Object[13];

  inhalt[0] = tn[0] = new Agent(tn[1]="jajahaha",paObject5d1(tn[3]=new Integer(23),tn[4]=new Integer(73),tn[5]=new Integer(43),tn[6]=new Integer(93),tn[3]));
  inhalt[1] = tn[7] = paint5d2(paint3d1(15,14,13),paint3d1(12,11,10),paint3d1(9,8,7),paint3d1(6,5,4),paint3d1(3,2,15));
}
}
-------------------------------------------------
But if i do something like:
  inhalt[1] = tn[7] = paint5d2(tn[8]=paint3d1(15,14,13),paint3d1(12,11,10),paint3d1(9,8,7),paint3d1(6,5,4),paint3d1(3,2,15));

the compiler says:
====================
Pm1.java:41: Incompatible type for method. Explicit cast needed to convert java.lang.Object to int[].
  inhalt[1] = tn[7] = paint5d2(tn[8]=paint3d1(15,14,13),paint3d1(12,11,10),paint3d1(9,8,7),paint3d1(6,5,4),paint3d1(3,2,15));
                              ^
1 error
====================
It seems to me that the compilers thinks that tn[8] (which is an Object) is a argument to paint5d2 (which wants in[t]).

Is this a compiler bug or am i wrong?

Greets, Fritz Hohl (currently working on some stupid persistency algorithm)

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post