I created the below program as a java console app in vs2015 w/ Elements v9.3.103.2211. It executed fine within vs2015 with proper handling of the arrays.
I then opened the project in Water w/Elements 10.0.0.2331 and built and ran it. It made array bb.fld point to array aa.fld. Debug output is also below.
Program:
namespace copyarraytest;
interface
uses
java.util;
type
fieldDef = public record
c,r,l: Word;
end;
fpFieldsArrayType = array [0..100] of fieldDef;
fpSessionType = public record
inUse : Boolean;
fld : fpFieldsArrayType;
fldCnt : Integer;
end;
fpSessionArrayType = array [0..10] of fpSessionType;
ConsoleApp = class
public
class method Main(args: array of String);
end;
implementation
var
aa : fpSessionArrayType;
bb : fpSessionType;
class method ConsoleApp.Main(args: array of String);
begin
aa[4].fld[0].c := 4;
aa[4].fld[0].r := 6;
aa[4].fld[0].l := 40;
bb.fld[0].c := 3;
bb.fld[0].r := 5;
bb.fld[0].l := 39;
writeLn('Before arraycopy');
writeLn('aa[4].fld[0]:c,r,l ='+aa[4].fld[0].c+','+aa[4].fld[0].r+','+aa[4].fld[0].l);
writeLn('bb.fld[0]:c,r,l ='+bb.fld[0].c+','+bb.fld[0].r+','+bb.fld[0].l);
System.arraycopy(aa[4].fld,0,bb.fld,0,1);
writeLn();
writeLn('After arraycopy');
writeLn('aa[4].fld[0]:c,r,l ='+aa[4].fld[0].c+','+aa[4].fld[0].r+','+aa[4].fld[0].l);
writeLn('bb.fld[0]:c,r,l ='+bb.fld[0].c+','+bb.fld[0].r+','+bb.fld[0].l);
writeLn();
writeLn('After setting bb.fld[0]:c,r,l to 1,2,3');
bb.fld[0].c := 1;
bb.fld[0].r := 2;
bb.fld[0].l := 3;
writeLn('aa[4].fld[0]:c,r,l ='+aa[4].fld[0].c+','+aa[4].fld[0].r+','+aa[4].fld[0].l);
writeLn('bb.fld[0]:c,r,l ='+bb.fld[0].c+','+bb.fld[0].r+','+bb.fld[0].l);
readLn();
end;
end.
Debut output:
Listening for transport dt_socket at address: 50976
~> Process copyarraytest started
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: copyarraytest.ConsoleApp
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: copyarraytest.ConsoleApp
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: copyarraytest.__Global
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: copyarraytest.__Global
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: copyarraytest.fpSessionType
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: copyarraytest.fpSessionType
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: copyarraytest.fieldDef
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: copyarraytest.fieldDef
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: com.remobjects.elements.ArrayUtils
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: com.remobjects.elements.ArrayUtils
Before arraycopy
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: com.remobjects.elements.system.UnsignedShort
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0001 ()
~> Message: java.lang.ClassNotFoundException: com.remobjects.elements.system.UnsignedShort
aa[4].fld[0]:c,r,l =4,6,40
bb.fld[0]:c,r,l =3,5,39
After arraycopy
aa[4].fld[0]:c,r,l =4,6,40
bb.fld[0]:c,r,l =4,6,40
After setting bb.fld[0]:c,r,l to 1,2,3
aa[4].fld[0]:c,r,l =1,2,3
bb.fld[0]:c,r,l =1,2,3
!> Fatal exception of type java.lang.NullPointerException on thread 0001 ()
!> Message: java.lang.NullPointerException
Exception in thread "main" java.lang.NullPointerException
at copyarraytest.ConsoleApp.main(C:\arrayTest\copyarraytest\copyarraytest\Program.pas:66)
~> Process copyarraytest terminated with exit code 1