Getting ArrayStoreException: Cannot store (valid inner subclass) in array of type (parent class)

Tom Tromey tromey@redhat.com
Wed Apr 30 18:37:00 GMT 2003


>>>>> "Scott" == Scott Gilbertson <scottg@mantatest.com> writes:

Scott> In my application, manta.mts5000.application.SoftkeyMenu.EntryCell is a
Scott> valid subclass of manta.mts5000.widgets.EntryField

Scott> The exception:
Scott> java.lang.ArrayStoreException: Cannot store
Scott> [Lmanta.mts5000.application.SoftkeyMenu$EntryCell;
Scott> in array of type
Scott> [Lmanta.mts5000.widgets.EntryField;
Scott>    at _Jv_CheckArrayStore
Scott> ...

Scott> Does anyone know why this might be happening?

It's just a bug in libgcj :-(.  You can reproduce it with the
appended.  How odd that we've never run across this before.

_Jv_CheckArrayStore needs to be taught about multi-dimensional arrays.

Tom

class a
{
}

class b extends a
{
}

public class ar
{
  public static void main(String[] args)
  {
    a[][] x1 = new a[3][3];
    b[] x2 = new b[5];
    x1[0] = x2;
  }
}



More information about the Java mailing list