Просмотр исходного кода

* full implementation of all routines in rtl/inc/ustringh.inc (except for
val/str for enums for now) for the JVM target: insert/delete/pos/...
* use generic unicodestring helper routines where possible for the JVM
target (not that many as for shortstrings since unicodestring is
handled using java.lang.String)
+ complete widestring manager implementation for the JVM target. It uses
a class with virtual methods rather than a record with function pointers
for speed reasons though (since no existing widestring manager will be
compatible anyway, that shouldn't cause any problems)

git-svn-id: branches/jvmbackend@18882 -

Jonas Maebe 14 лет назад
Родитель
Сommit
3a423b331c

+ 4 - 2
.gitattributes

@@ -7377,6 +7377,8 @@ rtl/java/jsystemh.inc svneol=native#text/plain
 rtl/java/jsystemh_types.inc svneol=native#text/plain
 rtl/java/jtvar.inc svneol=native#text/plain
 rtl/java/jtvarh.inc svneol=native#text/plain
+rtl/java/justringh.inc svneol=native#text/plain
+rtl/java/justrings.inc svneol=native#text/plain
 rtl/java/objpas.inc svneol=native#text/plain
 rtl/java/objpas.pp svneol=native#text/plain
 rtl/java/objpash.inc svneol=native#text/plain
@@ -7386,8 +7388,6 @@ rtl/java/sysos.inc svneol=native#text/plain
 rtl/java/sysosh.inc svneol=native#text/plain
 rtl/java/sysres.inc svneol=native#text/plain
 rtl/java/system.pp svneol=native#text/plain
-rtl/java/ustringh.inc svneol=native#text/plain
-rtl/java/ustrings.inc svneol=native#text/plain
 rtl/jvm/int64p.inc svneol=native#text/plain
 rtl/jvm/jvm.inc svneol=native#text/plain
 rtl/jvm/makefile.cpu svneol=native#text/plain
@@ -9803,7 +9803,9 @@ tests/test/jvm/trange2.pp svneol=native#text/plain
 tests/test/jvm/trange3.pp svneol=native#text/plain
 tests/test/jvm/tset1.pp svneol=native#text/plain
 tests/test/jvm/tset3.pp svneol=native#text/plain
+tests/test/jvm/tstr.pp svneol=native#text/plain
 tests/test/jvm/tstring1.pp svneol=native#text/plain
+tests/test/jvm/tstring9.pp svneol=native#text/plain
 tests/test/jvm/tstrreal1.pp svneol=native#text/plain
 tests/test/jvm/tstrreal2.pp svneol=native#text/plain
 tests/test/jvm/tthreadvar.pp svneol=native#text/plain

+ 2 - 0
compiler/options.pas

@@ -2521,7 +2521,9 @@ begin
 {$if defined(x86) or defined(arm) or defined(jvm)}
   def_system_macro('INTERNAL_BACKTRACE');
 {$endif}
+{$ifndef jvm}
   def_system_macro('STR_CONCAT_PROCS');
+{$endif}
 {$warnings off}
   if pocall_default = pocall_register then
     def_system_macro('REGCALL');

+ 3 - 0
rtl/inc/sstrings.inc

@@ -1062,9 +1062,12 @@ begin
     End;
 end;
 
+{$ifndef FPC_HAS_INT_VAL_SINT_SHORTSTR}
+{$define FPC_HAS_INT_VAL_SINT_SHORTSTR}
 { we need this for fpc_Val_SInt_Ansistr and fpc_Val_SInt_WideStr because }
 { we have to pass the DestSize parameter on (JM)                         }
 Function int_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; out Code: ValSInt): ValSInt; [external name 'FPC_VAL_SINT_SHORTSTR'];
+{$endif FPC_HAS_INT_VAL_SINT_SHORTSTR}
 
 
 Function fpc_Val_UInt_Shortstr(Const S: ShortString; out Code: ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_SHORTSTR']; compilerproc;

+ 2 - 0
rtl/inc/ustringh.inc

@@ -48,6 +48,7 @@ procedure UnicodeCharToStrVar(S : PUnicodeChar;out Dest : AnsiString);
 procedure DefaultUnicode2AnsiMove(source:punicodechar;var dest:ansistring;len:SizeInt);
 procedure DefaultAnsi2UnicodeMove(source:pchar;var dest:unicodestring;len:SizeInt);
 
+{$ifndef FPC_HAS_BUILTIN_WIDESTR_MANAGER}
 Type
   { hooks for internationalization
     please add new procedures at the end, it makes it easier to detect new procedures }
@@ -101,6 +102,7 @@ Type
     CompareUnicodeStringProc : function(const s1, s2 : UnicodeString) : PtrInt;
     CompareTextUnicodeStringProc : function(const s1, s2 : UnicodeString): PtrInt;
   end;
+{$endif FPC_HAS_BUILTIN_WIDESTR_MANAGER}
 
 var
   widestringmanager : TUnicodeStringManager;

Разница между файлами не показана из-за своего большого размера
+ 254 - 6
rtl/inc/ustrings.inc


+ 29 - 20
rtl/java/compproc.inc

@@ -89,6 +89,7 @@ procedure fpc_ansistr_bool(b : boolean;len:sizeint;out s:ansistring); compilerpr
 procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : ansistring); compilerproc;
 {$endif FPC_HAS_STR_CURRENCY}
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
+*)
 
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
   {$if not(defined(FPC_WIDESTRING_EQUAL_UNICODESTRING)) or defined(VER2_2)}
@@ -100,7 +101,6 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : ansistring)
   procedure fpc_UnicodeStr_uint(v : valuint;Len : SizeInt; out S : UnicodeString); compilerproc;
   {$endif VER2_2}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
-*)
 {$ifndef CPU64}
   procedure fpc_shortstr_qword(v : qword;len : SizeInt;out s : shortstring); compilerproc;
   procedure fpc_shortstr_int64(v : int64;len : SizeInt;out s : shortstring); compilerproc;
@@ -111,6 +111,7 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : ansistring)
   procedure fpc_ansistr_qword(v : qword;len : SizeInt;out s : ansistring); compilerproc;
   procedure fpc_ansistr_int64(v : int64;len : SizeInt;out s : ansistring); compilerproc;
   {$endif FPC_HAS_FEATURE_ANSISTRINGS}
+  *)
 
   {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
     {$if not(defined(FPC_WIDESTRING_EQUAL_UNICODESTRING)) or defined(VER2_2)}
@@ -122,9 +123,7 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : ansistring)
     procedure fpc_UnicodeStr_int64(v : int64;len : SizeInt;out s : UnicodeString); compilerproc;
     {$endif VER2_2}
   {$endif FPC_HAS_FEATURE_WIDESTRINGS}
-*)
 {$endif CPU64}
-(*
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
   {$if not(defined(FPC_WIDESTRING_EQUAL_UNICODESTRING)) or defined(VER2_2)}
     {$ifndef FPUNONE}
@@ -151,7 +150,6 @@ procedure fpc_AnsiStr_Currency(c : currency;len,fr : SizeInt;out s : ansistring)
     {$endif FPC_HAS_STR_CURRENCY}
   {$endif VER2_2}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
-*)
 
 {$ifndef FPUNONE}
 procedure fpc_chararray_Float(d : ValReal;len,fr,rt : SizeInt;out a : array of AnsiChar); compilerproc;
@@ -306,21 +304,34 @@ Function  fpc_ansistr_Copy (Const S : AnsiString; Index,Size : SizeInt) : AnsiSt
                         Unicode string support
 *****************************************************************************}
 
-Function fpc_ShortStr_To_UnicodeStr (Const S2 : ShortString): UnicodeString; compilerproc;
+{$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
+//Procedure fpc_UnicodeStr_Decr_Ref (Var S : Pointer); compilerproc;
+//Procedure fpc_UnicodeStr_Incr_Ref (S : Pointer); compilerproc;
+{$ifndef FPC_STRTOSHORTSTRINGPROC}
+function fpc_UnicodeStr_To_ShortStr (high_of_res: SizeInt;const S2 : UnicodeString): shortstring; compilerproc;
+{$else FPC_STRTOSHORTSTRINGPROC}
 procedure fpc_UnicodeStr_To_ShortStr (out res: ShortString;const S2 : UnicodeString); compilerproc;
+{$endif FPC_STRTOSHORTSTRINGPROC}
+Function fpc_ShortStr_To_UnicodeStr (Const S2 : ShortString): UnicodeString; compilerproc;
 Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString): AnsiString; compilerproc;
 Function fpc_AnsiStr_To_UnicodeStr (Const S2 : AnsiString): UnicodeString; compilerproc;
 Function fpc_UnicodeStr_To_WideStr (const S2 : UnicodeString): WideString; compilerproc;
 Function fpc_WideStr_To_UnicodeStr (Const S2 : WideString): UnicodeString; compilerproc;
+{$ifndef STR_CONCAT_PROCS}
 Function fpc_UnicodeStr_Concat (const S1,S2 : UnicodeString) : UnicodeString; compilerproc;
 function fpc_UnicodeStr_Concat_multi (const sarr:array of Unicodestring): unicodestring; compilerproc;
+{$else STR_CONCAT_PROCS}
+Procedure fpc_UnicodeStr_Concat (Var DestS : Unicodestring;const S1,S2 : UnicodeString); compilerproc;
+Procedure fpc_UnicodeStr_Concat_multi (Var DestS : Unicodestring;const sarr:array of Unicodestring); compilerproc;
+{$endif STR_CONCAT_PROCS}
 Function fpc_Char_To_UnicodeStr(const c : AnsiChar): UnicodeString; compilerproc;
+Function fpc_PChar_To_UnicodeStr(const p : pchar): UnicodeString; compilerproc;
 Function fpc_CharArray_To_UnicodeStr(const arr: array of AnsiChar; zerobased: boolean = true): UnicodeString; compilerproc;
 
 procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: UnicodeString); compilerproc;
 //procedure fpc_shortstr_to_unicodechararray(out res: array of unicodechar; const src: ShortString); compilerproc;
 //procedure fpc_ansistr_to_unicodechararray(out res: array of unicodechar; const src: AnsiString); compilerproc;
-procedure fpc_unicodestr_to_unicodechararray(out res: array of unicodechar; const src: UnicodeString); compilerproc;
+//procedure fpc_unicodestr_to_unicodechararray(out res: array of unicodechar; const src: UnicodeString); compilerproc;
 
 function fpc_unicodestr_setchar(const s: UnicodeString; const index: longint; const ch: unicodechar): UnicodeString; compilerproc;
 
@@ -332,7 +343,7 @@ procedure fpc_UnicodeCharArray_To_ShortStr(out res : shortstring;const arr: arra
 {$endif FPC_STRTOSHORTSTRINGPROC}
 Function fpc_UnicodeCharArray_To_AnsiStr(const arr: array of unicodechar; zerobased: boolean = true): AnsiString; compilerproc;
 *)
-Function fpc_UnicodeCharArray_To_UnicodeStr(const arr: array of unicodechar; zerobased: boolean = true): UnicodeString; compilerproc;
+//Function fpc_UnicodeCharArray_To_UnicodeStr(const arr: array of unicodechar; zerobased: boolean = true): UnicodeString; compilerproc;
 {$ifndef FPC_STRTOSHORTSTRINGPROC}
 Function fpc_WideCharArray_To_ShortStr(const arr: array of widechar; zerobased: boolean = true): shortstring; compilerproc;
 {$else FPC_STRTOSHORTSTRINGPROC}
@@ -363,30 +374,29 @@ Function  fpc_unicodestr_Copy (Const S : UnicodeString; Index,Size : SizeInt) :
 Function fpc_Char_To_UChar(const c : AnsiChar): UnicodeChar; compilerproc;
 Function fpc_UChar_To_Char(const c : UnicodeChar): AnsiChar; compilerproc;
 Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
-Function fpc_WChar_To_UnicodeStr(const c : WideChar): UnicodeString; compilerproc;
+//Function fpc_WChar_To_UnicodeStr(const c : WideChar): UnicodeString; compilerproc;
 Function fpc_UChar_To_AnsiStr(const c : UnicodeChar): AnsiString; compilerproc;
 {$ifndef FPC_STRTOSHORTSTRINGPROC}
-Function fpc_WChar_To_ShortStr(const c : WideChar): ShortString; compilerproc;
+Function fpc_UChar_To_ShortStr(const c : UnicodeChar): ShortString; compilerproc;
 {$else FPC_STRTOSHORTSTRINGPROC}
 procedure fpc_Char_To_ShortStr(out res : shortstring;const c : AnsiChar) compilerproc;
-procedure fpc_WChar_To_ShortStr(out res : shortstring;const c : WideChar) compilerproc;
+procedure fpc_UChar_To_ShortStr(out res : shortstring;const c : UnicodeChar) compilerproc;
 {$endif FPC_STRTOSHORTSTRINGPROC}
-(*
+{$endif FPC_HAS_FEATURE_WIDESTRINGS}
+
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
-Function fpc_PUnicodeChar_To_AnsiStr(const p : punicodechar): ansistring; compilerproc;
+//Function fpc_PUnicodeChar_To_AnsiStr(const p : punicodechar): ansistring; compilerproc;
 {$endif FPC_HAS_FEATURE_ANSISTRINGS}
-Function fpc_PUnicodeChar_To_UnicodeStr(const p : punicodechar): unicodestring; compilerproc;
+//Function fpc_PUnicodeChar_To_UnicodeStr(const p : punicodechar): unicodestring; compilerproc;
 Function fpc_PWideChar_To_UnicodeStr(const p : pwidechar): unicodestring; compilerproc;
 {$ifndef FPC_STRTOSHORTSTRINGPROC}
-Function fpc_PUnicodeChar_To_ShortStr(const p : punicodechar): shortstring; compilerproc;
+//Function fpc_PUnicodeChar_To_ShortStr(const p : punicodechar): shortstring; compilerproc;
 {$else FPC_STRTOSHORTSTRINGPROC}
-procedure fpc_PUnicodeChar_To_ShortStr(out res : shortstring;const p : punicodechar); compilerproc;
+//procedure fpc_PUnicodeChar_To_ShortStr(out res : shortstring;const p : punicodechar); compilerproc;
 {$endif FPC_STRTOSHORTSTRINGPROC}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
-*)
 
-(*
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
 {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
 Function fpc_PWideChar_To_AnsiStr(const p : pwidechar): ansistring; compilerproc;
@@ -397,11 +407,10 @@ Function fpc_PWideChar_To_ShortStr(const p : pwidechar): shortstring; compilerpr
 procedure fpc_PWideChar_To_ShortStr(out res : shortstring;const p : pwidechar); compilerproc;
 {$endif FPC_STRTOSHORTSTRINGPROC}
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
-*)
 
 {$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
-Function fpc_Char_To_WChar(const c : AnsiChar): WideChar; compilerproc;
-Function fpc_WChar_To_Char(const c : WideChar): AnsiChar; compilerproc;
+//Function fpc_Char_To_WChar(const c : AnsiChar): WideChar; compilerproc;
+//Function fpc_WChar_To_Char(const c : WideChar): AnsiChar; compilerproc;
 {$endif FPC_HAS_FEATURE_WIDESTRINGS}
 
 {$ifdef FPC_HAS_FEATURE_TEXTIO}

+ 360 - 0
rtl/java/java_sys.inc

@@ -106,6 +106,10 @@
     class function scalb(para1: jfloat; para2: jint): jfloat; static; overload;
   end;
 
+  JLReadable = interface external 'java.lang' name 'Readable' 
+    function read(para1: JNCharBuffer): jint; overload;  // throws java.io.IOException
+  end;
+
   JLRuntime = class external 'java.lang' name 'Runtime' (JLObject)
   public
     class function getRuntime(): JLRuntime; static; overload;
@@ -259,6 +263,153 @@
   JLRType = interface external 'java.lang.reflect' name 'Type' 
   end;
 
+  JNBuffer = class abstract external 'java.nio' name 'Buffer' (JLObject)
+  public
+    function capacity(): jint; overload; virtual; final;
+    function position(): jint; overload; virtual; final;
+    function position(para1: jint): JNBuffer; overload; virtual; final;
+    function limit(): jint; overload; virtual; final;
+    function limit(para1: jint): JNBuffer; overload; virtual; final;
+    function mark(): JNBuffer; overload; virtual; final;
+    function reset(): JNBuffer; overload; virtual; final;
+    function clear(): JNBuffer; overload; virtual; final;
+    function flip(): JNBuffer; overload; virtual; final;
+    function rewind(): JNBuffer; overload; virtual; final;
+    function remaining(): jint; overload; virtual; final;
+    function hasRemaining(): jboolean; overload; virtual; final;
+    function isReadOnly(): jboolean; overload; virtual; abstract;
+    function hasArray(): jboolean; overload; virtual; abstract;
+    function &array(): JLObject; overload; virtual; abstract;
+    function arrayOffset(): jint; overload; virtual; abstract;
+    function isDirect(): jboolean; overload; virtual; abstract;
+  end;
+
+  JNCCharsetDecoder = class abstract external 'java.nio.charset' name 'CharsetDecoder' (JLObject)
+  strict protected
+    constructor create(para1: JNCCharset; para2: jfloat; para3: jfloat); overload;
+  public
+    function charset(): JNCCharset; overload; virtual; final;
+    function replacement(): JLString; overload; virtual; final;
+    function replaceWith(para1: JLString): JNCCharsetDecoder; overload; virtual; final;
+  strict protected
+    procedure implReplaceWith(para1: JLString); overload; virtual;
+  public
+    function malformedInputAction(): JNCCodingErrorAction; overload; virtual;
+    function onMalformedInput(para1: JNCCodingErrorAction): JNCCharsetDecoder; overload; virtual; final;
+  strict protected
+    procedure implOnMalformedInput(para1: JNCCodingErrorAction); overload; virtual;
+  public
+    function unmappableCharacterAction(): JNCCodingErrorAction; overload; virtual;
+    function onUnmappableCharacter(para1: JNCCodingErrorAction): JNCCharsetDecoder; overload; virtual; final;
+  strict protected
+    procedure implOnUnmappableCharacter(para1: JNCCodingErrorAction); overload; virtual;
+  public
+    function averageCharsPerByte(): jfloat; overload; virtual; final;
+    function maxCharsPerByte(): jfloat; overload; virtual; final;
+    function decode(para1: JNByteBuffer; para2: JNCharBuffer; para3: jboolean): JNCCoderResult; overload; virtual; final;
+    function flush(para1: JNCharBuffer): JNCCoderResult; overload; virtual; final;
+  strict protected
+    function implFlush(para1: JNCharBuffer): JNCCoderResult; overload; virtual;
+  public
+    function reset(): JNCCharsetDecoder; overload; virtual; final;
+  strict protected
+    procedure implReset(); overload; virtual;
+    function decodeLoop(para1: JNByteBuffer; para2: JNCharBuffer): JNCCoderResult; overload; virtual; abstract;
+  public
+    function decode(para1: JNByteBuffer): JNCharBuffer; overload; virtual; final;  // throws java.nio.charset.CharacterCodingException
+    function isAutoDetecting(): jboolean; overload; virtual;
+    function isCharsetDetected(): jboolean; overload; virtual;
+    function detectedCharset(): JNCCharset; overload; virtual;
+  end;
+
+  JNCCharsetEncoder = class abstract external 'java.nio.charset' name 'CharsetEncoder' (JLObject)
+  strict protected
+    constructor create(para1: JNCCharset; para2: jfloat; para3: jfloat; para4: Arr1jbyte); overload;
+    constructor create(para1: JNCCharset; para2: jfloat; para3: jfloat; const para4: array of jbyte); overload;
+    constructor create(para1: JNCCharset; para2: jfloat; para3: jfloat); overload;
+  public
+    function charset(): JNCCharset; overload; virtual; final;
+    function replacement(): Arr1jbyte; overload; virtual; final;
+    function replaceWith(para1: Arr1jbyte): JNCCharsetEncoder; overload; virtual; final;
+    function replaceWith(var para1: array of jbyte): JNCCharsetEncoder; overload; virtual; final;
+  strict protected
+    procedure implReplaceWith(para1: Arr1jbyte); overload; virtual;
+    procedure implReplaceWith(var para1: array of jbyte); overload; virtual;
+  public
+    function isLegalReplacement(para1: Arr1jbyte): jboolean; overload; virtual;
+    function isLegalReplacement(var para1: array of jbyte): jboolean; overload; virtual;
+    function malformedInputAction(): JNCCodingErrorAction; overload; virtual;
+    function onMalformedInput(para1: JNCCodingErrorAction): JNCCharsetEncoder; overload; virtual; final;
+  strict protected
+    procedure implOnMalformedInput(para1: JNCCodingErrorAction); overload; virtual;
+  public
+    function unmappableCharacterAction(): JNCCodingErrorAction; overload; virtual;
+    function onUnmappableCharacter(para1: JNCCodingErrorAction): JNCCharsetEncoder; overload; virtual; final;
+  strict protected
+    procedure implOnUnmappableCharacter(para1: JNCCodingErrorAction); overload; virtual;
+  public
+    function averageBytesPerChar(): jfloat; overload; virtual; final;
+    function maxBytesPerChar(): jfloat; overload; virtual; final;
+    function encode(para1: JNCharBuffer; para2: JNByteBuffer; para3: jboolean): JNCCoderResult; overload; virtual; final;
+    function flush(para1: JNByteBuffer): JNCCoderResult; overload; virtual; final;
+  strict protected
+    function implFlush(para1: JNByteBuffer): JNCCoderResult; overload; virtual;
+  public
+    function reset(): JNCCharsetEncoder; overload; virtual; final;
+  strict protected
+    procedure implReset(); overload; virtual;
+    function encodeLoop(para1: JNCharBuffer; para2: JNByteBuffer): JNCCoderResult; overload; virtual; abstract;
+  public
+    function encode(para1: JNCharBuffer): JNByteBuffer; overload; virtual; final;  // throws java.nio.charset.CharacterCodingException
+    function canEncode(para1: jchar): jboolean; overload; virtual;
+    function canEncode(para1: JLCharSequence): jboolean; overload; virtual;
+  end;
+
+  JNCCoderResult = class external 'java.nio.charset' name 'CoderResult' (JLObject)
+  public
+    type
+      InnerCache = class;
+      Arr1InnerCache = array of InnerCache;
+      Arr2InnerCache = array of Arr1InnerCache;
+      Arr3InnerCache = array of Arr2InnerCache;
+      InnerCache = class abstract external 'java.nio.charset' name 'Cache' 
+      end;
+
+  public
+    final class var
+      fUNDERFLOW: JNCCoderResult; external name 'UNDERFLOW';
+      fOVERFLOW: JNCCoderResult; external name 'OVERFLOW';
+  public
+    function toString(): JLString; overload; virtual;
+    function isUnderflow(): jboolean; overload; virtual;
+    function isOverflow(): jboolean; overload; virtual;
+    function isError(): jboolean; overload; virtual;
+    function isMalformed(): jboolean; overload; virtual;
+    function isUnmappable(): jboolean; overload; virtual;
+    function length(): jint; overload; virtual;
+    class function malformedForLength(para1: jint): JNCCoderResult; static; overload;
+    class function unmappableForLength(para1: jint): JNCCoderResult; static; overload;
+    procedure throwException(); overload; virtual;  // throws java.nio.charset.CharacterCodingException
+  end;
+
+  JNCCodingErrorAction = class external 'java.nio.charset' name 'CodingErrorAction' (JLObject)
+  public
+    final class var
+      fIGNORE: JNCCodingErrorAction; external name 'IGNORE';
+      fREPLACE: JNCCodingErrorAction; external name 'REPLACE';
+      fREPORT: JNCCodingErrorAction; external name 'REPORT';
+  public
+    function toString(): JLString; overload; virtual;
+  end;
+
+  JNCSCharsetProvider = class abstract external 'java.nio.charset.spi' name 'CharsetProvider' (JLObject)
+  strict protected
+    constructor create(); overload;
+  public
+    function charsets(): JUIterator; overload; virtual; abstract;
+    function charsetForName(para1: JLString): JNCCharset; overload; virtual; abstract;
+  end;
+
   JUArrays = class external 'java.util' name 'Arrays' (JLObject)
   public
     type
@@ -1132,6 +1283,35 @@
     function compareTo(para1: JLObject): jint; overload; virtual;
   end;
 
+  JNCCharset = class abstract external 'java.nio.charset' name 'Charset' (JLObject, JLComparable)
+  public
+    class function isSupported(para1: JLString): jboolean; static; overload;
+    class function forName(para1: JLString): JNCCharset; static; overload;
+    class function availableCharsets(): JUSortedMap; static; overload;
+    class function defaultCharset(): JNCCharset; static; overload;
+  strict protected
+    constructor create(para1: JLString; para2: Arr1JLString); overload;
+    constructor create(para1: JLString; const para2: array of JLString); overload;
+  public
+    function name(): JLString; overload; virtual; final;
+    function aliases(): JUSet; overload; virtual; final;
+    function displayName(): JLString; overload; virtual;
+    function isRegistered(): jboolean; overload; virtual; final;
+    function displayName(para1: JULocale): JLString; overload; virtual;
+    function contains(para1: JNCCharset): jboolean; overload; virtual; abstract;
+    function newDecoder(): JNCCharsetDecoder; overload; virtual; abstract;
+    function newEncoder(): JNCCharsetEncoder; overload; virtual; abstract;
+    function canEncode(): jboolean; overload; virtual;
+    function decode(para1: JNByteBuffer): JNCharBuffer; overload; virtual; final;
+    function encode(para1: JNCharBuffer): JNByteBuffer; overload; virtual; final;
+    function encode(para1: JLString): JNByteBuffer; overload; virtual; final;
+    function compareTo(para1: JNCCharset): jint; overload; virtual; final;
+    function hashCode(): jint; overload; virtual; final;
+    function equals(para1: JLObject): jboolean; overload; virtual; final;
+    function toString(): JLString; overload; virtual; final;
+    function compareTo(para1: JLObject): jint; overload; virtual;
+  end;
+
   JUCalendar = class abstract external 'java.util' name 'Calendar' (JLObject, JISerializable, JLCloneable, JLComparable)
   public
     type
@@ -1370,6 +1550,126 @@
     function getDeclaredAnnotations(): Arr1JLAAnnotation; overload; virtual;
   end;
 
+  JNByteBuffer = class abstract external 'java.nio' name 'ByteBuffer' (JNBuffer, JLComparable)
+  public
+    class function allocateDirect(para1: jint): JNByteBuffer; static; overload;
+    class function allocate(para1: jint): JNByteBuffer; static; overload;
+    class function wrap(para1: Arr1jbyte; para2: jint; para3: jint): JNByteBuffer; static; overload;
+    class function wrap(var para1: array of jbyte; para2: jint; para3: jint): JNByteBuffer; static; overload;
+    class function wrap(para1: Arr1jbyte): JNByteBuffer; static; overload;
+    class function wrap(var para1: array of jbyte): JNByteBuffer; static; overload;
+    function slice(): JNByteBuffer; overload; virtual; abstract;
+    function duplicate(): JNByteBuffer; overload; virtual; abstract;
+    function asReadOnlyBuffer(): JNByteBuffer; overload; virtual; abstract;
+    function get(): jbyte; overload; virtual; abstract;
+    function put(para1: jbyte): JNByteBuffer; overload; virtual; abstract;
+    function get(para1: jint): jbyte; overload; virtual; abstract;
+    function put(para1: jint; para2: jbyte): JNByteBuffer; overload; virtual; abstract;
+    function get(para1: Arr1jbyte; para2: jint; para3: jint): JNByteBuffer; overload; virtual;
+    function get(var para1: array of jbyte; para2: jint; para3: jint): JNByteBuffer; overload; virtual;
+    function get(para1: Arr1jbyte): JNByteBuffer; overload; virtual;
+    function get(var para1: array of jbyte): JNByteBuffer; overload; virtual;
+    function put(para1: JNByteBuffer): JNByteBuffer; overload; virtual;
+    function put(para1: Arr1jbyte; para2: jint; para3: jint): JNByteBuffer; overload; virtual;
+    function put(var para1: array of jbyte; para2: jint; para3: jint): JNByteBuffer; overload; virtual;
+    function put(para1: Arr1jbyte): JNByteBuffer; overload; virtual; final;
+    function put(var para1: array of jbyte): JNByteBuffer; overload; virtual; final;
+    function hasArray(): jboolean; overload; virtual; final;
+    function &array(): Arr1jbyte; overload; virtual; final;
+    function arrayOffset(): jint; overload; virtual; final;
+    function compact(): JNByteBuffer; overload; virtual; abstract;
+    function isDirect(): jboolean; overload; virtual; abstract;
+    function toString(): JLString; overload; virtual;
+    function hashCode(): jint; overload; virtual;
+    function equals(para1: JLObject): jboolean; overload; virtual;
+    function compareTo(para1: JNByteBuffer): jint; overload; virtual;
+    function order(): JNByteOrder; overload; virtual; final;
+    function order(para1: JNByteOrder): JNByteBuffer; overload; virtual; final;
+    function getChar(): jchar; overload; virtual; abstract;
+    function putChar(para1: jchar): JNByteBuffer; overload; virtual; abstract;
+    function getChar(para1: jint): jchar; overload; virtual; abstract;
+    function putChar(para1: jint; para2: jchar): JNByteBuffer; overload; virtual; abstract;
+    function asCharBuffer(): JNCharBuffer; overload; virtual; abstract;
+    function getShort(): jshort; overload; virtual; abstract;
+    function putShort(para1: jshort): JNByteBuffer; overload; virtual; abstract;
+    function getShort(para1: jint): jshort; overload; virtual; abstract;
+    function putShort(para1: jint; para2: jshort): JNByteBuffer; overload; virtual; abstract;
+    function asShortBuffer(): JNShortBuffer; overload; virtual; abstract;
+    function getInt(): jint; overload; virtual; abstract;
+    function putInt(para1: jint): JNByteBuffer; overload; virtual; abstract;
+    function getInt(para1: jint): jint; overload; virtual; abstract;
+    function putInt(para1: jint; para2: jint): JNByteBuffer; overload; virtual; abstract;
+    function asIntBuffer(): JNIntBuffer; overload; virtual; abstract;
+    function getLong(): jlong; overload; virtual; abstract;
+    function putLong(para1: jlong): JNByteBuffer; overload; virtual; abstract;
+    function getLong(para1: jint): jlong; overload; virtual; abstract;
+    function putLong(para1: jint; para2: jlong): JNByteBuffer; overload; virtual; abstract;
+    function asLongBuffer(): JNLongBuffer; overload; virtual; abstract;
+    function getFloat(): jfloat; overload; virtual; abstract;
+    function putFloat(para1: jfloat): JNByteBuffer; overload; virtual; abstract;
+    function getFloat(para1: jint): jfloat; overload; virtual; abstract;
+    function putFloat(para1: jint; para2: jfloat): JNByteBuffer; overload; virtual; abstract;
+    function asFloatBuffer(): JNFloatBuffer; overload; virtual; abstract;
+    function getDouble(): jdouble; overload; virtual; abstract;
+    function putDouble(para1: jdouble): JNByteBuffer; overload; virtual; abstract;
+    function getDouble(para1: jint): jdouble; overload; virtual; abstract;
+    function putDouble(para1: jint; para2: jdouble): JNByteBuffer; overload; virtual; abstract;
+    function asDoubleBuffer(): JNDoubleBuffer; overload; virtual; abstract;
+    function &array(): JLObject; overload; virtual;
+    function compareTo(para1: JLObject): jint; overload; virtual;
+  end;
+
+  JNCharBuffer = class abstract external 'java.nio' name 'CharBuffer' (JNBuffer, JLComparable, JLAppendable, JLCharSequence, JLReadable)
+  public
+    class function allocate(para1: jint): JNCharBuffer; static; overload;
+    class function wrap(para1: Arr1jchar; para2: jint; para3: jint): JNCharBuffer; static; overload;
+    class function wrap(var para1: array of jchar; para2: jint; para3: jint): JNCharBuffer; static; overload;
+    class function wrap(para1: Arr1jchar): JNCharBuffer; static; overload;
+    class function wrap(var para1: array of jchar): JNCharBuffer; static; overload;
+    function read(para1: JNCharBuffer): jint; overload; virtual;  // throws java.io.IOException
+    class function wrap(para1: JLCharSequence; para2: jint; para3: jint): JNCharBuffer; static; overload;
+    class function wrap(para1: JLCharSequence): JNCharBuffer; static; overload;
+    function slice(): JNCharBuffer; overload; virtual; abstract;
+    function duplicate(): JNCharBuffer; overload; virtual; abstract;
+    function asReadOnlyBuffer(): JNCharBuffer; overload; virtual; abstract;
+    function get(): jchar; overload; virtual; abstract;
+    function put(para1: jchar): JNCharBuffer; overload; virtual; abstract;
+    function get(para1: jint): jchar; overload; virtual; abstract;
+    function put(para1: jint; para2: jchar): JNCharBuffer; overload; virtual; abstract;
+    function get(para1: Arr1jchar; para2: jint; para3: jint): JNCharBuffer; overload; virtual;
+    function get(var para1: array of jchar; para2: jint; para3: jint): JNCharBuffer; overload; virtual;
+    function get(para1: Arr1jchar): JNCharBuffer; overload; virtual;
+    function get(var para1: array of jchar): JNCharBuffer; overload; virtual;
+    function put(para1: JNCharBuffer): JNCharBuffer; overload; virtual;
+    function put(para1: Arr1jchar; para2: jint; para3: jint): JNCharBuffer; overload; virtual;
+    function put(var para1: array of jchar; para2: jint; para3: jint): JNCharBuffer; overload; virtual;
+    function put(para1: Arr1jchar): JNCharBuffer; overload; virtual; final;
+    function put(var para1: array of jchar): JNCharBuffer; overload; virtual; final;
+    function put(para1: JLString; para2: jint; para3: jint): JNCharBuffer; overload; virtual;
+    function put(para1: JLString): JNCharBuffer; overload; virtual; final;
+    function hasArray(): jboolean; overload; virtual; final;
+    function &array(): Arr1jchar; overload; virtual; final;
+    function arrayOffset(): jint; overload; virtual; final;
+    function compact(): JNCharBuffer; overload; virtual; abstract;
+    function isDirect(): jboolean; overload; virtual; abstract;
+    function hashCode(): jint; overload; virtual;
+    function equals(para1: JLObject): jboolean; overload; virtual;
+    function compareTo(para1: JNCharBuffer): jint; overload; virtual;
+    function toString(): JLString; overload; virtual;
+    function length(): jint; overload; virtual; final;
+    function charAt(para1: jint): jchar; overload; virtual; final;
+    function subSequence(para1: jint; para2: jint): JLCharSequence; overload; virtual; abstract;
+    function append(para1: JLCharSequence): JNCharBuffer; overload; virtual;
+    function append(para1: JLCharSequence; para2: jint; para3: jint): JNCharBuffer; overload; virtual;
+    function append(para1: jchar): JNCharBuffer; overload; virtual;
+    function order(): JNByteOrder; overload; virtual; abstract;
+    function &array(): JLObject; overload; virtual;
+    function compareTo(para1: JLObject): jint; overload; virtual;
+    function append(para1: jchar): JLAppendable; overload; virtual;  // throws java.io.IOException
+    function append(para1: JLCharSequence; para2: jint; para3: jint): JLAppendable; overload; virtual;  // throws java.io.IOException
+    function append(para1: JLCharSequence): JLAppendable; overload; virtual;  // throws java.io.IOException
+  end;
+
   JTCollator = class abstract external 'java.text' name 'Collator' (JLObject, JUComparator, JLCloneable)
   public
     type
@@ -2226,6 +2526,19 @@
     constructor create(para1: JLString); overload;
   end;
 
+  JNCCoderMalfunctionError = class external 'java.nio.charset' name 'CoderMalfunctionError' (JLError)
+  public
+    constructor create(para1: JLException); overload;
+  end;
+
+  JIIOException = class external 'java.io' name 'IOException' (JLException)
+  public
+    constructor create(); overload;
+    constructor create(para1: JLString); overload;
+    constructor create(para1: JLString; para2: JLThrowable); overload;
+    constructor create(para1: JLThrowable); overload;
+  end;
+
   JLNoSuchMethodException = class external 'java.lang' name 'NoSuchMethodException' (JLException)
   public
     constructor create(); overload;
@@ -2249,6 +2562,11 @@
     function removeAll(para1: JUCollection): jboolean; overload; virtual;
   end;
 
+  JNCCharacterCodingException = class external 'java.nio.charset' name 'CharacterCodingException' (JIIOException)
+  public
+    constructor create(); overload;
+  end;
+
   JLIllegalArgumentException = class external 'java.lang' name 'IllegalArgumentException' (JLRuntimeException)
   public
     constructor create(); overload;
@@ -2257,12 +2575,28 @@
     constructor create(para1: JLThrowable); overload;
   end;
 
+  JLIllegalStateException = class external 'java.lang' name 'IllegalStateException' (JLRuntimeException)
+  public
+    constructor create(); overload;
+    constructor create(para1: JLString); overload;
+    constructor create(para1: JLString; para2: JLThrowable); overload;
+    constructor create(para1: JLThrowable); overload;
+  end;
+
   JLIndexOutOfBoundsException = class external 'java.lang' name 'IndexOutOfBoundsException' (JLRuntimeException)
   public
     constructor create(); overload;
     constructor create(para1: JLString); overload;
   end;
 
+  JLUnsupportedOperationException = class external 'java.lang' name 'UnsupportedOperationException' (JLRuntimeException)
+  public
+    constructor create(); overload;
+    constructor create(para1: JLString); overload;
+    constructor create(para1: JLString; para2: JLThrowable); overload;
+    constructor create(para1: JLThrowable); overload;
+  end;
+
   JUEnumSet = class abstract external 'java.util' name 'EnumSet' (JUAbstractSet, JLCloneable, JISerializable)
   public
     type
@@ -2291,3 +2625,29 @@
     function clone(): JLObject; overload; virtual;  // throws java.lang.CloneNotSupportedException
   end;
 
+  JNCMalformedInputException = class external 'java.nio.charset' name 'MalformedInputException' (JNCCharacterCodingException)
+  public
+    constructor create(para1: jint); overload;
+    function getInputLength(): jint; overload; virtual;
+    function getMessage(): JLString; overload; virtual;
+  end;
+
+  JNCUnmappableCharacterException = class external 'java.nio.charset' name 'UnmappableCharacterException' (JNCCharacterCodingException)
+  public
+    constructor create(para1: jint); overload;
+    function getInputLength(): jint; overload; virtual;
+    function getMessage(): JLString; overload; virtual;
+  end;
+
+  JNCIllegalCharsetNameException = class external 'java.nio.charset' name 'IllegalCharsetNameException' (JLIllegalArgumentException)
+  public
+    constructor create(para1: JLString); overload;
+    function getCharsetName(): JLString; overload; virtual;
+  end;
+
+  JNCUnsupportedCharsetException = class external 'java.nio.charset' name 'UnsupportedCharsetException' (JLIllegalArgumentException)
+  public
+    constructor create(para1: JLString); overload;
+    function getCharsetName(): JLString; overload; virtual;
+  end;
+

+ 269 - 144
rtl/java/java_sysh.inc

@@ -1,15 +1,10 @@
-{ Imports for Java packages/classes: java.io.Serializable, java.lang.AbstractStringBuilder, java.lang.Appendable, java.lang.Boolean, java.lang.Byte, java.lang.CharSequence, java.lang.Character, java.lang.Class, java.lang.Cloneable, java.lang.Comparable, java.lang.Double, java.lang.Enum, java.lang.Error, java.lang.Exception, java.lang.Float, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException, java.lang.Integer, java.lang.Iterable, java.lang.LinkageError, java.lang.Long, java.lang.Math, java.lang.NoSuchMethodException, java.lang.Number, java.lang.Object, java.lang.Runtime, java.lang.RuntimeException, java.lang.Short, java.lang.String, java.lang.StringBuffer, java.lang.StringBuilder, java.lang.System, java.lang.ThreadLocal, java.lang.Throwable, java.lang.reflect.AccessibleObject, java.lang.reflect.AnnotatedElement, java.lang.reflect.Array, java.lang.reflect.Field, java.lang.reflect.GenericDeclaration, java.lang.reflect.Member, java.lang.reflect.Method, java.lang.reflect.Type, java.math.BigInteger, java.text.Collator, java.util.AbstractCollection, java.util.AbstractMap, java.util.AbstractSet, java.util.Arrays, java.util.BitSet, java.util.Calendar, java.util.Collection, java.util.Comparator, java.util.EnumSet, java.util.HashMap, java.util.Iterator, java.util.Map, java.util.Set }
+{ Imports for Java packages/classes: java.io.IIOException, java.io.IOException, java.io.Serializable, java.lang.AbstractStringBuilder, java.lang.Appendable, java.lang.Boolean, java.lang.Byte, java.lang.CharSequence, java.lang.Character, java.lang.Class, java.lang.Cloneable, java.lang.Comparable, java.lang.Double, java.lang.Enum, java.lang.Error, java.lang.Exception, java.lang.Float, java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.IndexOutOfBoundsException, java.lang.Integer, java.lang.Iterable, java.lang.LinkageError, java.lang.Long, java.lang.Math, java.lang.NoSuchMethodException, java.lang.Number, java.lang.Object, java.lang.Readable, java.lang.Runtime, java.lang.RuntimeException, java.lang.Short, java.lang.String, java.lang.StringBuffer, java.lang.StringBuilder, java.lang.System, java.lang.ThreadLocal, java.lang.Throwable, java.lang.UnsupportedOperationException, java.lang.reflect.AccessibleObject, java.lang.reflect.AnnotatedElement, java.lang.reflect.Array, java.lang.reflect.Field, java.lang.reflect.GenericDeclaration, java.lang.reflect.Member, java.lang.reflect.Method, java.lang.reflect.Type, java.math.BigInteger, java.nio.Buffer, java.nio.ByteBuffer, java.nio.CharBuffer, java.nio.charset., java.text.Collator, java.util.AbstractCollection, java.util.AbstractMap, java.util.AbstractSet, java.util.Arrays, java.util.BitSet, java.util.Calendar, java.util.Collection, java.util.Comparator, java.util.EnumSet, java.util.HashMap, java.util.Iterator, java.util.Map, java.util.Set }
 type
   JLNoSuchMethodException = class;
   Arr1JLNoSuchMethodException = array of JLNoSuchMethodException;
   Arr2JLNoSuchMethodException = array of Arr1JLNoSuchMethodException;
   Arr3JLNoSuchMethodException = array of Arr2JLNoSuchMethodException;
 
-  JLStringBuffer = class;
-  Arr1JLStringBuffer = array of JLStringBuffer;
-  Arr2JLStringBuffer = array of Arr1JLStringBuffer;
-  Arr3JLStringBuffer = array of Arr2JLStringBuffer;
-
   JLObject = class;
   Arr1JLObject = array of JLObject;
   Arr2JLObject = array of Arr1JLObject;
@@ -25,51 +20,26 @@ type
   Arr2JLAbstractStringBuilder = array of Arr1JLAbstractStringBuilder;
   Arr3JLAbstractStringBuilder = array of Arr2JLAbstractStringBuilder;
 
-  JLEnum = class;
-  Arr1JLEnum = array of JLEnum;
-  Arr2JLEnum = array of Arr1JLEnum;
-  Arr3JLEnum = array of Arr2JLEnum;
-
-  JLRField = class;
-  Arr1JLRField = array of JLRField;
-  Arr2JLRField = array of Arr1JLRField;
-  Arr3JLRField = array of Arr2JLRField;
-
   JLError = class;
   Arr1JLError = array of JLError;
   Arr2JLError = array of Arr1JLError;
   Arr3JLError = array of Arr2JLError;
 
-  JLNumber = class;
-  Arr1JLNumber = array of JLNumber;
-  Arr2JLNumber = array of Arr1JLNumber;
-  Arr3JLNumber = array of Arr2JLNumber;
-
-  JLRMethod = class;
-  Arr1JLRMethod = array of JLRMethod;
-  Arr2JLRMethod = array of Arr1JLRMethod;
-  Arr3JLRMethod = array of Arr2JLRMethod;
-
-  JLCharacter = class;
-  Arr1JLCharacter = array of JLCharacter;
-  Arr2JLCharacter = array of Arr1JLCharacter;
-  Arr3JLCharacter = array of Arr2JLCharacter;
+  JLRField = class;
+  Arr1JLRField = array of JLRField;
+  Arr2JLRField = array of Arr1JLRField;
+  Arr3JLRField = array of Arr2JLRField;
 
-  JMBigInteger = class;
-  Arr1JMBigInteger = array of JMBigInteger;
-  Arr2JMBigInteger = array of Arr1JMBigInteger;
-  Arr3JMBigInteger = array of Arr2JMBigInteger;
+  JNBuffer = class;
+  Arr1JNBuffer = array of JNBuffer;
+  Arr2JNBuffer = array of Arr1JNBuffer;
+  Arr3JNBuffer = array of Arr2JNBuffer;
 
   JUArrays = class;
   Arr1JUArrays = array of JUArrays;
   Arr2JUArrays = array of Arr1JUArrays;
   Arr3JUArrays = array of Arr2JUArrays;
 
-  JLBoolean = class;
-  Arr1JLBoolean = array of JLBoolean;
-  Arr2JLBoolean = array of Arr1JLBoolean;
-  Arr3JLBoolean = array of Arr2JLBoolean;
-
   JLRuntime = class;
   Arr1JLRuntime = array of JLRuntime;
   Arr2JLRuntime = array of Arr1JLRuntime;
@@ -85,60 +55,55 @@ type
   Arr2JLMath = array of Arr1JLMath;
   Arr3JLMath = array of Arr2JLMath;
 
-  JLShort = class;
-  Arr1JLShort = array of JLShort;
-  Arr2JLShort = array of Arr1JLShort;
-  Arr3JLShort = array of Arr2JLShort;
-
-  JLInteger = class;
-  Arr1JLInteger = array of JLInteger;
-  Arr2JLInteger = array of Arr1JLInteger;
-  Arr3JLInteger = array of Arr2JLInteger;
-
-  JLThrowable = class;
-  Arr1JLThrowable = array of JLThrowable;
-  Arr2JLThrowable = array of Arr1JLThrowable;
-  Arr3JLThrowable = array of Arr2JLThrowable;
+  JNCharBuffer = class;
+  Arr1JNCharBuffer = array of JNCharBuffer;
+  Arr2JNCharBuffer = array of Arr1JNCharBuffer;
+  Arr3JNCharBuffer = array of Arr2JNCharBuffer;
 
   JLLinkageError = class;
   Arr1JLLinkageError = array of JLLinkageError;
   Arr2JLLinkageError = array of Arr1JLLinkageError;
   Arr3JLLinkageError = array of Arr2JLLinkageError;
 
-  JLByte = class;
-  Arr1JLByte = array of JLByte;
-  Arr2JLByte = array of Arr1JLByte;
-  Arr3JLByte = array of Arr2JLByte;
+  JNCCharsetEncoder = class;
+  Arr1JNCCharsetEncoder = array of JNCCharsetEncoder;
+  Arr2JNCCharsetEncoder = array of Arr1JNCCharsetEncoder;
+  Arr3JNCCharsetEncoder = array of Arr2JNCCharsetEncoder;
 
   JUAbstractCollection = class;
   Arr1JUAbstractCollection = array of JUAbstractCollection;
   Arr2JUAbstractCollection = array of Arr1JUAbstractCollection;
   Arr3JUAbstractCollection = array of Arr2JUAbstractCollection;
 
-  JUAbstractMap = class;
-  Arr1JUAbstractMap = array of JUAbstractMap;
-  Arr2JUAbstractMap = array of Arr1JUAbstractMap;
-  Arr3JUAbstractMap = array of Arr2JUAbstractMap;
+  JNCCoderResult = class;
+  Arr1JNCCoderResult = array of JNCCoderResult;
+  Arr2JNCCoderResult = array of Arr1JNCCoderResult;
+  Arr3JNCCoderResult = array of Arr2JNCCoderResult;
 
   JLThreadLocal = class;
   Arr1JLThreadLocal = array of JLThreadLocal;
   Arr2JLThreadLocal = array of Arr1JLThreadLocal;
   Arr3JLThreadLocal = array of Arr2JLThreadLocal;
 
-  JLRArray = class;
-  Arr1JLRArray = array of JLRArray;
-  Arr2JLRArray = array of Arr1JLRArray;
-  Arr3JLRArray = array of Arr2JLRArray;
+  JUAbstractMap = class;
+  Arr1JUAbstractMap = array of JUAbstractMap;
+  Arr2JUAbstractMap = array of Arr1JUAbstractMap;
+  Arr3JUAbstractMap = array of Arr2JUAbstractMap;
+
+  JNCCoderMalfunctionError = class;
+  Arr1JNCCoderMalfunctionError = array of JNCCoderMalfunctionError;
+  Arr2JNCCoderMalfunctionError = array of Arr1JNCCoderMalfunctionError;
+  Arr3JNCCoderMalfunctionError = array of Arr2JNCCoderMalfunctionError;
 
   JUEnumSet = class;
   Arr1JUEnumSet = array of JUEnumSet;
   Arr2JUEnumSet = array of Arr1JUEnumSet;
   Arr3JUEnumSet = array of Arr2JUEnumSet;
 
-  JLException = class;
-  Arr1JLException = array of JLException;
-  Arr2JLException = array of Arr1JLException;
-  Arr3JLException = array of Arr2JLException;
+  JNCCharacterCodingException = class;
+  Arr1JNCCharacterCodingException = array of JNCCharacterCodingException;
+  Arr2JNCCharacterCodingException = array of Arr1JNCCharacterCodingException;
+  Arr3JNCCharacterCodingException = array of Arr2JNCCharacterCodingException;
 
   JLIndexOutOfBoundsException = class;
   Arr1JLIndexOutOfBoundsException = array of JLIndexOutOfBoundsException;
@@ -150,41 +115,26 @@ type
   Arr2JUHashMap = array of Arr1JUHashMap;
   Arr3JUHashMap = array of Arr2JUHashMap;
 
-  JLDouble = class;
-  Arr1JLDouble = array of JLDouble;
-  Arr2JLDouble = array of Arr1JLDouble;
-  Arr3JLDouble = array of Arr2JLDouble;
-
   JUCalendar = class;
   Arr1JUCalendar = array of JUCalendar;
   Arr2JUCalendar = array of Arr1JUCalendar;
   Arr3JUCalendar = array of Arr2JUCalendar;
 
-  JTCollator = class;
-  Arr1JTCollator = array of JTCollator;
-  Arr2JTCollator = array of Arr1JTCollator;
-  Arr3JTCollator = array of Arr2JTCollator;
+  JLDouble = class;
+  Arr1JLDouble = array of JLDouble;
+  Arr2JLDouble = array of Arr1JLDouble;
+  Arr3JLDouble = array of Arr2JLDouble;
 
   JUBitSet = class;
   Arr1JUBitSet = array of JUBitSet;
   Arr2JUBitSet = array of Arr1JUBitSet;
   Arr3JUBitSet = array of Arr2JUBitSet;
 
-  JLIllegalArgumentException = class;
-  Arr1JLIllegalArgumentException = array of JLIllegalArgumentException;
-  Arr2JLIllegalArgumentException = array of Arr1JLIllegalArgumentException;
-  Arr3JLIllegalArgumentException = array of Arr2JLIllegalArgumentException;
-
   JLString = class;
   Arr1JLString = array of JLString;
   Arr2JLString = array of Arr1JLString;
   Arr3JLString = array of Arr2JLString;
 
-  JLClass = class;
-  Arr1JLClass = array of JLClass;
-  Arr2JLClass = array of Arr1JLClass;
-  Arr3JLClass = array of Arr2JLClass;
-
   JUAbstractSet = class;
   Arr1JUAbstractSet = array of JUAbstractSet;
   Arr2JUAbstractSet = array of Arr1JUAbstractSet;
@@ -195,21 +145,161 @@ type
   Arr2JLFloat = array of Arr1JLFloat;
   Arr3JLFloat = array of Arr2JLFloat;
 
-  JLSystem = class;
-  Arr1JLSystem = array of JLSystem;
-  Arr2JLSystem = array of Arr1JLSystem;
-  Arr3JLSystem = array of Arr2JLSystem;
-
   JLRuntimeException = class;
   Arr1JLRuntimeException = array of JLRuntimeException;
   Arr2JLRuntimeException = array of Arr1JLRuntimeException;
   Arr3JLRuntimeException = array of Arr2JLRuntimeException;
 
+  JLIllegalStateException = class;
+  Arr1JLIllegalStateException = array of JLIllegalStateException;
+  Arr2JLIllegalStateException = array of Arr1JLIllegalStateException;
+  Arr3JLIllegalStateException = array of Arr2JLIllegalStateException;
+
   JLRAccessibleObject = class;
   Arr1JLRAccessibleObject = array of JLRAccessibleObject;
   Arr2JLRAccessibleObject = array of Arr1JLRAccessibleObject;
   Arr3JLRAccessibleObject = array of Arr2JLRAccessibleObject;
 
+  JLStringBuffer = class;
+  Arr1JLStringBuffer = array of JLStringBuffer;
+  Arr2JLStringBuffer = array of Arr1JLStringBuffer;
+  Arr3JLStringBuffer = array of Arr2JLStringBuffer;
+
+  JNByteBuffer = class;
+  Arr1JNByteBuffer = array of JNByteBuffer;
+  Arr2JNByteBuffer = array of Arr1JNByteBuffer;
+  Arr3JNByteBuffer = array of Arr2JNByteBuffer;
+
+  JLEnum = class;
+  Arr1JLEnum = array of JLEnum;
+  Arr2JLEnum = array of Arr1JLEnum;
+  Arr3JLEnum = array of Arr2JLEnum;
+
+  JNCSCharsetProvider = class;
+  Arr1JNCSCharsetProvider = array of JNCSCharsetProvider;
+  Arr2JNCSCharsetProvider = array of Arr1JNCSCharsetProvider;
+  Arr3JNCSCharsetProvider = array of Arr2JNCSCharsetProvider;
+
+  JLNumber = class;
+  Arr1JLNumber = array of JLNumber;
+  Arr2JLNumber = array of Arr1JLNumber;
+  Arr3JLNumber = array of Arr2JLNumber;
+
+  JIIOException = class;
+  Arr1JIIOException = array of JIIOException;
+  Arr2JIIOException = array of Arr1JIIOException;
+  Arr3JIIOException = array of Arr2JIIOException;
+
+  JLRMethod = class;
+  Arr1JLRMethod = array of JLRMethod;
+  Arr2JLRMethod = array of Arr1JLRMethod;
+  Arr3JLRMethod = array of Arr2JLRMethod;
+
+  JLCharacter = class;
+  Arr1JLCharacter = array of JLCharacter;
+  Arr2JLCharacter = array of Arr1JLCharacter;
+  Arr3JLCharacter = array of Arr2JLCharacter;
+
+  JNCCodingErrorAction = class;
+  Arr1JNCCodingErrorAction = array of JNCCodingErrorAction;
+  Arr2JNCCodingErrorAction = array of Arr1JNCCodingErrorAction;
+  Arr3JNCCodingErrorAction = array of Arr2JNCCodingErrorAction;
+
+  JMBigInteger = class;
+  Arr1JMBigInteger = array of JMBigInteger;
+  Arr2JMBigInteger = array of Arr1JMBigInteger;
+  Arr3JMBigInteger = array of Arr2JMBigInteger;
+
+  JNCCharsetDecoder = class;
+  Arr1JNCCharsetDecoder = array of JNCCharsetDecoder;
+  Arr2JNCCharsetDecoder = array of Arr1JNCCharsetDecoder;
+  Arr3JNCCharsetDecoder = array of Arr2JNCCharsetDecoder;
+
+  JLBoolean = class;
+  Arr1JLBoolean = array of JLBoolean;
+  Arr2JLBoolean = array of Arr1JLBoolean;
+  Arr3JLBoolean = array of Arr2JLBoolean;
+
+  JNCCharset = class;
+  Arr1JNCCharset = array of JNCCharset;
+  Arr2JNCCharset = array of Arr1JNCCharset;
+  Arr3JNCCharset = array of Arr2JNCCharset;
+
+  JLShort = class;
+  Arr1JLShort = array of JLShort;
+  Arr2JLShort = array of Arr1JLShort;
+  Arr3JLShort = array of Arr2JLShort;
+
+  JLThrowable = class;
+  Arr1JLThrowable = array of JLThrowable;
+  Arr2JLThrowable = array of Arr1JLThrowable;
+  Arr3JLThrowable = array of Arr2JLThrowable;
+
+  JLInteger = class;
+  Arr1JLInteger = array of JLInteger;
+  Arr2JLInteger = array of Arr1JLInteger;
+  Arr3JLInteger = array of Arr2JLInteger;
+
+  JNCUnmappableCharacterException = class;
+  Arr1JNCUnmappableCharacterException = array of JNCUnmappableCharacterException;
+  Arr2JNCUnmappableCharacterException = array of Arr1JNCUnmappableCharacterException;
+  Arr3JNCUnmappableCharacterException = array of Arr2JNCUnmappableCharacterException;
+
+  JNCMalformedInputException = class;
+  Arr1JNCMalformedInputException = array of JNCMalformedInputException;
+  Arr2JNCMalformedInputException = array of Arr1JNCMalformedInputException;
+  Arr3JNCMalformedInputException = array of Arr2JNCMalformedInputException;
+
+  JNCIllegalCharsetNameException = class;
+  Arr1JNCIllegalCharsetNameException = array of JNCIllegalCharsetNameException;
+  Arr2JNCIllegalCharsetNameException = array of Arr1JNCIllegalCharsetNameException;
+  Arr3JNCIllegalCharsetNameException = array of Arr2JNCIllegalCharsetNameException;
+
+  JLByte = class;
+  Arr1JLByte = array of JLByte;
+  Arr2JLByte = array of Arr1JLByte;
+  Arr3JLByte = array of Arr2JLByte;
+
+  JNCUnsupportedCharsetException = class;
+  Arr1JNCUnsupportedCharsetException = array of JNCUnsupportedCharsetException;
+  Arr2JNCUnsupportedCharsetException = array of Arr1JNCUnsupportedCharsetException;
+  Arr3JNCUnsupportedCharsetException = array of Arr2JNCUnsupportedCharsetException;
+
+  JLRArray = class;
+  Arr1JLRArray = array of JLRArray;
+  Arr2JLRArray = array of Arr1JLRArray;
+  Arr3JLRArray = array of Arr2JLRArray;
+
+  JLUnsupportedOperationException = class;
+  Arr1JLUnsupportedOperationException = array of JLUnsupportedOperationException;
+  Arr2JLUnsupportedOperationException = array of Arr1JLUnsupportedOperationException;
+  Arr3JLUnsupportedOperationException = array of Arr2JLUnsupportedOperationException;
+
+  JLException = class;
+  Arr1JLException = array of JLException;
+  Arr2JLException = array of Arr1JLException;
+  Arr3JLException = array of Arr2JLException;
+
+  JTCollator = class;
+  Arr1JTCollator = array of JTCollator;
+  Arr2JTCollator = array of Arr1JTCollator;
+  Arr3JTCollator = array of Arr2JTCollator;
+
+  JLClass = class;
+  Arr1JLClass = array of JLClass;
+  Arr2JLClass = array of Arr1JLClass;
+  Arr3JLClass = array of Arr2JLClass;
+
+  JLIllegalArgumentException = class;
+  Arr1JLIllegalArgumentException = array of JLIllegalArgumentException;
+  Arr2JLIllegalArgumentException = array of Arr1JLIllegalArgumentException;
+  Arr3JLIllegalArgumentException = array of Arr2JLIllegalArgumentException;
+
+  JLSystem = class;
+  Arr1JLSystem = array of JLSystem;
+  Arr2JLSystem = array of Arr1JLSystem;
+  Arr3JLSystem = array of Arr2JLSystem;
+
   JLIterable = interface;
   Arr1JLIterable = array of JLIterable;
   Arr2JLIterable = array of Arr1JLIterable;
@@ -285,46 +375,101 @@ type
   Arr2JISerializable = array of Arr1JISerializable;
   Arr3JISerializable = array of Arr2JISerializable;
 
-  JIFile = class external 'java.io' name 'File';
-  Arr1JIFile = array of JIFile;
-  Arr2JIFile = array of Arr1JIFile;
-  Arr3JIFile = array of Arr2JIFile;
-
-  JLStackTraceElement = class external 'java.lang' name 'StackTraceElement';
-  Arr1JLStackTraceElement = array of JLStackTraceElement;
-  Arr2JLStackTraceElement = array of Arr1JLStackTraceElement;
-  Arr3JLStackTraceElement = array of Arr2JLStackTraceElement;
+  JLReadable = interface;
+  Arr1JLReadable = array of JLReadable;
+  Arr2JLReadable = array of Arr1JLReadable;
+  Arr3JLReadable = array of Arr2JLReadable;
 
-  JLClassLoader = class external 'java.lang' name 'ClassLoader';
-  Arr1JLClassLoader = array of JLClassLoader;
-  Arr2JLClassLoader = array of Arr1JLClassLoader;
-  Arr3JLClassLoader = array of Arr2JLClassLoader;
+  JLThread = class external 'java.lang' name 'Thread';
+  Arr1JLThread = array of JLThread;
+  Arr2JLThread = array of Arr1JLThread;
+  Arr3JLThread = array of Arr2JLThread;
 
   JUDate = class external 'java.util' name 'Date';
   Arr1JUDate = array of JUDate;
   Arr2JUDate = array of Arr1JUDate;
   Arr3JUDate = array of Arr2JUDate;
 
-  JLThread = class external 'java.lang' name 'Thread';
-  Arr1JLThread = array of JLThread;
-  Arr2JLThread = array of Arr1JLThread;
-  Arr3JLThread = array of Arr2JLThread;
+  JLClassLoader = class external 'java.lang' name 'ClassLoader';
+  Arr1JLClassLoader = array of JLClassLoader;
+  Arr2JLClassLoader = array of Arr1JLClassLoader;
+  Arr3JLClassLoader = array of Arr2JLClassLoader;
 
-  JUProperties = class external 'java.util' name 'Properties';
-  Arr1JUProperties = array of JUProperties;
-  Arr2JUProperties = array of Arr1JUProperties;
-  Arr3JUProperties = array of Arr2JUProperties;
+  JNByteOrder = class external 'java.nio' name 'ByteOrder';
+  Arr1JNByteOrder = array of JNByteOrder;
+  Arr2JNByteOrder = array of Arr1JNByteOrder;
+  Arr3JNByteOrder = array of Arr2JNByteOrder;
+
+  JNIntBuffer = class external 'java.nio' name 'IntBuffer';
+  Arr1JNIntBuffer = array of JNIntBuffer;
+  Arr2JNIntBuffer = array of Arr1JNIntBuffer;
+  Arr3JNIntBuffer = array of Arr2JNIntBuffer;
 
   JIInputStream = class external 'java.io' name 'InputStream';
   Arr1JIInputStream = array of JIInputStream;
   Arr2JIInputStream = array of Arr1JIInputStream;
   Arr3JIInputStream = array of Arr2JIInputStream;
 
+  JNLongBuffer = class external 'java.nio' name 'LongBuffer';
+  Arr1JNLongBuffer = array of JNLongBuffer;
+  Arr2JNLongBuffer = array of Arr1JNLongBuffer;
+  Arr3JNLongBuffer = array of Arr2JNLongBuffer;
+
   JLSecurityManager = class external 'java.lang' name 'SecurityManager';
   Arr1JLSecurityManager = array of JLSecurityManager;
   Arr2JLSecurityManager = array of Arr1JLSecurityManager;
   Arr3JLSecurityManager = array of Arr2JLSecurityManager;
 
+  JIPrintWriter = class external 'java.io' name 'PrintWriter';
+  Arr1JIPrintWriter = array of JIPrintWriter;
+  Arr2JIPrintWriter = array of Arr1JIPrintWriter;
+  Arr3JIPrintWriter = array of Arr2JIPrintWriter;
+
+  JNDoubleBuffer = class external 'java.nio' name 'DoubleBuffer';
+  Arr1JNDoubleBuffer = array of JNDoubleBuffer;
+  Arr2JNDoubleBuffer = array of Arr1JNDoubleBuffer;
+  Arr3JNDoubleBuffer = array of Arr2JNDoubleBuffer;
+
+  JLPackage = class external 'java.lang' name 'Package';
+  Arr1JLPackage = array of JLPackage;
+  Arr2JLPackage = array of Arr1JLPackage;
+  Arr3JLPackage = array of Arr2JLPackage;
+
+  JURandom = class external 'java.util' name 'Random';
+  Arr1JURandom = array of JURandom;
+  Arr2JURandom = array of Arr1JURandom;
+  Arr3JURandom = array of Arr2JURandom;
+
+  JIOutputStream = class external 'java.io' name 'OutputStream';
+  Arr1JIOutputStream = array of JIOutputStream;
+  Arr2JIOutputStream = array of Arr1JIOutputStream;
+  Arr3JIOutputStream = array of Arr2JIOutputStream;
+
+  JLStackTraceElement = class external 'java.lang' name 'StackTraceElement';
+  Arr1JLStackTraceElement = array of JLStackTraceElement;
+  Arr2JLStackTraceElement = array of Arr1JLStackTraceElement;
+  Arr3JLStackTraceElement = array of Arr2JLStackTraceElement;
+
+  JIFile = class external 'java.io' name 'File';
+  Arr1JIFile = array of JIFile;
+  Arr2JIFile = array of Arr1JIFile;
+  Arr3JIFile = array of Arr2JIFile;
+
+  JUProperties = class external 'java.util' name 'Properties';
+  Arr1JUProperties = array of JUProperties;
+  Arr2JUProperties = array of Arr1JUProperties;
+  Arr3JUProperties = array of Arr2JUProperties;
+
+  JNFloatBuffer = class external 'java.nio' name 'FloatBuffer';
+  Arr1JNFloatBuffer = array of JNFloatBuffer;
+  Arr2JNFloatBuffer = array of Arr1JNFloatBuffer;
+  Arr3JNFloatBuffer = array of Arr2JNFloatBuffer;
+
+  JNShortBuffer = class external 'java.nio' name 'ShortBuffer';
+  Arr1JNShortBuffer = array of JNShortBuffer;
+  Arr2JNShortBuffer = array of Arr1JNShortBuffer;
+  Arr3JNShortBuffer = array of Arr2JNShortBuffer;
+
   JSProtectionDomain = class external 'java.security' name 'ProtectionDomain';
   Arr1JSProtectionDomain = array of JSProtectionDomain;
   Arr2JSProtectionDomain = array of Arr1JSProtectionDomain;
@@ -345,56 +490,31 @@ type
   Arr2JLRConstructor = array of Arr1JLRConstructor;
   Arr3JLRConstructor = array of Arr2JLRConstructor;
 
-  JIPrintWriter = class external 'java.io' name 'PrintWriter';
-  Arr1JIPrintWriter = array of JIPrintWriter;
-  Arr2JIPrintWriter = array of Arr1JIPrintWriter;
-  Arr3JIPrintWriter = array of Arr2JIPrintWriter;
-
-  JLPackage = class external 'java.lang' name 'Package';
-  Arr1JLPackage = array of JLPackage;
-  Arr2JLPackage = array of Arr1JLPackage;
-  Arr3JLPackage = array of Arr2JLPackage;
-
   JNURL = class external 'java.net' name 'URL';
   Arr1JNURL = array of JNURL;
   Arr2JNURL = array of Arr1JNURL;
   Arr3JNURL = array of Arr2JNURL;
 
-  JLProcess = class external 'java.lang' name 'Process';
-  Arr1JLProcess = array of JLProcess;
-  Arr2JLProcess = array of Arr1JLProcess;
-  Arr3JLProcess = array of Arr2JLProcess;
-
   JIConsole = class external 'java.io' name 'Console';
   Arr1JIConsole = array of JIConsole;
   Arr2JIConsole = array of Arr1JIConsole;
   Arr3JIConsole = array of Arr2JIConsole;
 
+  JLProcess = class external 'java.lang' name 'Process';
+  Arr1JLProcess = array of JLProcess;
+  Arr2JLProcess = array of Arr1JLProcess;
+  Arr3JLProcess = array of Arr2JLProcess;
+
   JULocale = class external 'java.util' name 'Locale';
   Arr1JULocale = array of JULocale;
   Arr2JULocale = array of Arr1JULocale;
   Arr3JULocale = array of Arr2JULocale;
 
-  JNCCharset = class external 'java.nio.charset' name 'Charset';
-  Arr1JNCCharset = array of JNCCharset;
-  Arr2JNCCharset = array of Arr1JNCCharset;
-  Arr3JNCCharset = array of Arr2JNCCharset;
-
   JUTimeZone = class external 'java.util' name 'TimeZone';
   Arr1JUTimeZone = array of JUTimeZone;
   Arr2JUTimeZone = array of Arr1JUTimeZone;
   Arr3JUTimeZone = array of Arr2JUTimeZone;
 
-  JURandom = class external 'java.util' name 'Random';
-  Arr1JURandom = array of JURandom;
-  Arr2JURandom = array of Arr1JURandom;
-  Arr3JURandom = array of Arr2JURandom;
-
-  JIOutputStream = class external 'java.io' name 'OutputStream';
-  Arr1JIOutputStream = array of JIOutputStream;
-  Arr2JIOutputStream = array of Arr1JIOutputStream;
-  Arr3JIOutputStream = array of Arr2JIOutputStream;
-
   JUList = interface external 'java.util' name 'List';
   Arr1JUList = array of JUList;
   Arr2JUList = array of Arr1JUList;
@@ -415,4 +535,9 @@ type
   Arr2JLRTypeVariable = array of Arr1JLRTypeVariable;
   Arr3JLRTypeVariable = array of Arr2JLRTypeVariable;
 
+  JUSortedMap = interface external 'java.util' name 'SortedMap';
+  Arr1JUSortedMap = array of JUSortedMap;
+  Arr2JUSortedMap = array of Arr1JUSortedMap;
+  Arr3JUSortedMap = array of Arr2JUSortedMap;
+
 

Разница между файлами не показана из-за своего большого размера
+ 701 - 225
rtl/java/jdk15.inc


+ 199 - 244
rtl/java/jdk15.pas

@@ -125,11 +125,6 @@ type
   Arr2OOCNStringNameHelper = array of Arr1OOCNStringNameHelper;
   Arr3OOCNStringNameHelper = array of Arr2OOCNStringNameHelper;
 
-  JNCharBuffer = class;
-  Arr1JNCharBuffer = array of JNCharBuffer;
-  Arr2JNCharBuffer = array of Arr1JNCharBuffer;
-  Arr3JNCharBuffer = array of Arr2JNCharBuffer;
-
   OOPServantActivatorPOA = class;
   Arr1OOPServantActivatorPOA = array of OOPServantActivatorPOA;
   Arr2OOPServantActivatorPOA = array of Arr1OOPServantActivatorPOA;
@@ -770,11 +765,6 @@ type
   Arr2JAEMouseEvent = array of Arr1JAEMouseEvent;
   Arr3JAEMouseEvent = array of Arr2JAEMouseEvent;
 
-  JNCCodingErrorAction = class;
-  Arr1JNCCodingErrorAction = array of JNCCodingErrorAction;
-  Arr2JNCCodingErrorAction = array of Arr1JNCCodingErrorAction;
-  Arr3JNCCodingErrorAction = array of Arr2JNCCodingErrorAction;
-
   JNSocketPermissionCollection = class;
   Arr1JNSocketPermissionCollection = array of JNSocketPermissionCollection;
   Arr2JNSocketPermissionCollection = array of Arr1JNSocketPermissionCollection;
@@ -1015,16 +1005,16 @@ type
   Arr2JSecurityTimestamp = array of Arr1JSecurityTimestamp;
   Arr3JSecurityTimestamp = array of Arr2JSecurityTimestamp;
 
-  JNDirectFloatBufferRS = class;
-  Arr1JNDirectFloatBufferRS = array of JNDirectFloatBufferRS;
-  Arr2JNDirectFloatBufferRS = array of Arr1JNDirectFloatBufferRS;
-  Arr3JNDirectFloatBufferRS = array of Arr2JNDirectFloatBufferRS;
-
   JSJSplitPane = class;
   Arr1JSJSplitPane = array of JSJSplitPane;
   Arr2JSJSplitPane = array of Arr1JSJSplitPane;
   Arr3JSJSplitPane = array of Arr2JSJSplitPane;
 
+  JNDirectFloatBufferRS = class;
+  Arr1JNDirectFloatBufferRS = array of JNDirectFloatBufferRS;
+  Arr2JNDirectFloatBufferRS = array of Arr1JNDirectFloatBufferRS;
+  Arr3JNDirectFloatBufferRS = array of Arr2JNDirectFloatBufferRS;
+
   JXWHolder = class;
   Arr1JXWHolder = array of JXWHolder;
   Arr2JXWHolder = array of Arr1JXWHolder;
@@ -1325,16 +1315,16 @@ type
   Arr2OXSInputSource = array of Arr1OXSInputSource;
   Arr3OXSInputSource = array of Arr2OXSInputSource;
 
-  JNByteBufferAsCharBufferRB = class;
-  Arr1JNByteBufferAsCharBufferRB = array of JNByteBufferAsCharBufferRB;
-  Arr2JNByteBufferAsCharBufferRB = array of Arr1JNByteBufferAsCharBufferRB;
-  Arr3JNByteBufferAsCharBufferRB = array of Arr2JNByteBufferAsCharBufferRB;
-
   JMRRelationNotification = class;
   Arr1JMRRelationNotification = array of JMRRelationNotification;
   Arr2JMRRelationNotification = array of Arr1JMRRelationNotification;
   Arr3JMRRelationNotification = array of Arr2JMRRelationNotification;
 
+  JNByteBufferAsCharBufferRB = class;
+  Arr1JNByteBufferAsCharBufferRB = array of JNByteBufferAsCharBufferRB;
+  Arr2JNByteBufferAsCharBufferRB = array of Arr1JNByteBufferAsCharBufferRB;
+  Arr3JNByteBufferAsCharBufferRB = array of Arr2JNByteBufferAsCharBufferRB;
+
   JNIDN = class;
   Arr1JNIDN = array of JNIDN;
   Arr2JNIDN = array of Arr1JNIDN;
@@ -1685,16 +1675,16 @@ type
   Arr2JMImmutableDescriptor = array of Arr1JMImmutableDescriptor;
   Arr3JMImmutableDescriptor = array of Arr2JMImmutableDescriptor;
 
-  JNHeapIntBufferR = class;
-  Arr1JNHeapIntBufferR = array of JNHeapIntBufferR;
-  Arr2JNHeapIntBufferR = array of Arr1JNHeapIntBufferR;
-  Arr3JNHeapIntBufferR = array of Arr2JNHeapIntBufferR;
-
   JARadialGradientPaint = class;
   Arr1JARadialGradientPaint = array of JARadialGradientPaint;
   Arr2JARadialGradientPaint = array of Arr1JARadialGradientPaint;
   Arr3JARadialGradientPaint = array of Arr2JARadialGradientPaint;
 
+  JNHeapIntBufferR = class;
+  Arr1JNHeapIntBufferR = array of JNHeapIntBufferR;
+  Arr2JNHeapIntBufferR = array of Arr1JNHeapIntBufferR;
+  Arr3JNHeapIntBufferR = array of Arr2JNHeapIntBufferR;
+
   JNDirectLongBufferU = class;
   Arr1JNDirectLongBufferU = array of JNDirectLongBufferU;
   Arr2JNDirectLongBufferU = array of Arr1JNDirectLongBufferU;
@@ -2090,11 +2080,6 @@ type
   Arr2JCSDHPrivateKeySpec = array of Arr1JCSDHPrivateKeySpec;
   Arr3JCSDHPrivateKeySpec = array of Arr2JCSDHPrivateKeySpec;
 
-  JNCSCharsetProvider = class;
-  Arr1JNCSCharsetProvider = array of JNCSCharsetProvider;
-  Arr2JNCSCharsetProvider = array of Arr1JNCSCharsetProvider;
-  Arr3JNCSCharsetProvider = array of Arr2JNCSCharsetProvider;
-
   JAIDataBufferInt = class;
   Arr1JAIDataBufferInt = array of JAIDataBufferInt;
   Arr2JAIDataBufferInt = array of Arr1JAIDataBufferInt;
@@ -2310,16 +2295,16 @@ type
   Arr2OXSSAXNotSupportedException = array of Arr1OXSSAXNotSupportedException;
   Arr3OXSSAXNotSupportedException = array of Arr2OXSSAXNotSupportedException;
 
-  JNCCancelledKeyException = class;
-  Arr1JNCCancelledKeyException = array of JNCCancelledKeyException;
-  Arr2JNCCancelledKeyException = array of Arr1JNCCancelledKeyException;
-  Arr3JNCCancelledKeyException = array of Arr2JNCCancelledKeyException;
-
   JNConfigurationException = class;
   Arr1JNConfigurationException = array of JNConfigurationException;
   Arr2JNConfigurationException = array of Arr1JNConfigurationException;
   Arr3JNConfigurationException = array of Arr2JNConfigurationException;
 
+  JNCCancelledKeyException = class;
+  Arr1JNCCancelledKeyException = array of JNCCancelledKeyException;
+  Arr2JNCCancelledKeyException = array of Arr1JNCCancelledKeyException;
+  Arr3JNCCancelledKeyException = array of Arr2JNCCancelledKeyException;
+
   JMMBeanServerPermission = class;
   Arr1JMMBeanServerPermission = array of JMMBeanServerPermission;
   Arr2JMMBeanServerPermission = array of Arr1JMMBeanServerPermission;
@@ -2850,11 +2835,6 @@ type
   Arr2JCIllegalBlockSizeException = array of Arr1JCIllegalBlockSizeException;
   Arr3JCIllegalBlockSizeException = array of Arr2JCIllegalBlockSizeException;
 
-  JNCFileLockInterruptionException = class;
-  Arr1JNCFileLockInterruptionException = array of JNCFileLockInterruptionException;
-  Arr2JNCFileLockInterruptionException = array of Arr1JNCFileLockInterruptionException;
-  Arr3JNCFileLockInterruptionException = array of Arr2JNCFileLockInterruptionException;
-
   JSTHBlockView = class;
   Arr1JSTHBlockView = array of JSTHBlockView;
   Arr2JSTHBlockView = array of Arr1JSTHBlockView;
@@ -2865,6 +2845,11 @@ type
   Arr2JNLinkException = array of Arr1JNLinkException;
   Arr3JNLinkException = array of Arr2JNLinkException;
 
+  JNCFileLockInterruptionException = class;
+  Arr1JNCFileLockInterruptionException = array of JNCFileLockInterruptionException;
+  Arr2JNCFileLockInterruptionException = array of Arr1JNCFileLockInterruptionException;
+  Arr3JNCFileLockInterruptionException = array of Arr2JNCFileLockInterruptionException;
+
   OOC_BindingIteratorImplBase = class;
   Arr1OOC_BindingIteratorImplBase = array of OOC_BindingIteratorImplBase;
   Arr2OOC_BindingIteratorImplBase = array of Arr1OOC_BindingIteratorImplBase;
@@ -3200,16 +3185,16 @@ type
   Arr2JUCTimeUnit = array of Arr1JUCTimeUnit;
   Arr3JUCTimeUnit = array of Arr2JUCTimeUnit;
 
-  JSAPolicy = class;
-  Arr1JSAPolicy = array of JSAPolicy;
-  Arr2JSAPolicy = array of Arr1JSAPolicy;
-  Arr3JSAPolicy = array of Arr2JSAPolicy;
-
   JMOInvalidKeyException = class;
   Arr1JMOInvalidKeyException = array of JMOInvalidKeyException;
   Arr2JMOInvalidKeyException = array of Arr1JMOInvalidKeyException;
   Arr3JMOInvalidKeyException = array of Arr2JMOInvalidKeyException;
 
+  JSAPolicy = class;
+  Arr1JSAPolicy = array of JSAPolicy;
+  Arr2JSAPolicy = array of Arr1JSAPolicy;
+  Arr3JSAPolicy = array of Arr2JSAPolicy;
+
   JSPMMetalLabelUI = class;
   Arr1JSPMMetalLabelUI = array of JSPMMetalLabelUI;
   Arr2JSPMMetalLabelUI = array of Arr1JSPMMetalLabelUI;
@@ -3330,6 +3315,11 @@ type
   Arr2JPASJobMediaSheets = array of Arr1JPASJobMediaSheets;
   Arr3JPASJobMediaSheets = array of Arr2JPASJobMediaSheets;
 
+  JUCCopyOnWriteArraySet = class;
+  Arr1JUCCopyOnWriteArraySet = array of JUCCopyOnWriteArraySet;
+  Arr2JUCCopyOnWriteArraySet = array of Arr1JUCCopyOnWriteArraySet;
+  Arr3JUCCopyOnWriteArraySet = array of Arr2JUCCopyOnWriteArraySet;
+
   JMMutableBigInteger = class;
   Arr1JMMutableBigInteger = array of JMMutableBigInteger;
   Arr2JMMutableBigInteger = array of Arr1JMMutableBigInteger;
@@ -3340,11 +3330,6 @@ type
   Arr2JXStreamFactoryFinder = array of Arr1JXStreamFactoryFinder;
   Arr3JXStreamFactoryFinder = array of Arr2JXStreamFactoryFinder;
 
-  JUCCopyOnWriteArraySet = class;
-  Arr1JUCCopyOnWriteArraySet = array of JUCCopyOnWriteArraySet;
-  Arr2JUCCopyOnWriteArraySet = array of Arr1JUCCopyOnWriteArraySet;
-  Arr3JUCCopyOnWriteArraySet = array of Arr2JUCCopyOnWriteArraySet;
-
   JUZDeflaterOutputStream = class;
   Arr1JUZDeflaterOutputStream = array of JUZDeflaterOutputStream;
   Arr2JUZDeflaterOutputStream = array of Arr1JUZDeflaterOutputStream;
@@ -3840,11 +3825,6 @@ type
   Arr2JSTFlowView = array of Arr1JSTFlowView;
   Arr3JSTFlowView = array of Arr2JSTFlowView;
 
-  JNCCoderResult = class;
-  Arr1JNCCoderResult = array of JNCCoderResult;
-  Arr2JNCCoderResult = array of Arr1JNCCoderResult;
-  Arr3JNCCoderResult = array of Arr2JNCCoderResult;
-
   JNCannotProceedException = class;
   Arr1JNCannotProceedException = array of JNCannotProceedException;
   Arr2JNCannotProceedException = array of Arr1JNCannotProceedException;
@@ -4290,16 +4270,16 @@ type
   Arr2JCKeyGeneratorSpi = array of Arr1JCKeyGeneratorSpi;
   Arr3JCKeyGeneratorSpi = array of Arr2JCKeyGeneratorSpi;
 
-  JUGregorianCalendar = class;
-  Arr1JUGregorianCalendar = array of JUGregorianCalendar;
-  Arr2JUGregorianCalendar = array of Arr1JUGregorianCalendar;
-  Arr3JUGregorianCalendar = array of Arr2JUGregorianCalendar;
-
   JSCX509CertSelector = class;
   Arr1JSCX509CertSelector = array of JSCX509CertSelector;
   Arr2JSCX509CertSelector = array of Arr1JSCX509CertSelector;
   Arr3JSCX509CertSelector = array of Arr2JSCX509CertSelector;
 
+  JUGregorianCalendar = class;
+  Arr1JUGregorianCalendar = array of JUGregorianCalendar;
+  Arr2JUGregorianCalendar = array of Arr1JUGregorianCalendar;
+  Arr3JUGregorianCalendar = array of Arr2JUGregorianCalendar;
+
   JSSECFieldFp = class;
   Arr1JSSECFieldFp = array of JSSECFieldFp;
   Arr2JSSECFieldFp = array of Arr1JSSECFieldFp;
@@ -4355,11 +4335,6 @@ type
   Arr2JCSunJCE_j = array of Arr1JCSunJCE_j;
   Arr3JCSunJCE_j = array of Arr2JCSunJCE_j;
 
-  JNCCharacterCodingException = class;
-  Arr1JNCCharacterCodingException = array of JNCCharacterCodingException;
-  Arr2JNCCharacterCodingException = array of Arr1JNCCharacterCodingException;
-  Arr3JNCCharacterCodingException = array of Arr2JNCCharacterCodingException;
-
   JIIIOParam = class;
   Arr1JIIIOParam = array of JIIIOParam;
   Arr2JIIIOParam = array of Arr1JIIIOParam;
@@ -4590,16 +4565,16 @@ type
   Arr2JAIImagingOpException = array of Arr1JAIImagingOpException;
   Arr3JAIImagingOpException = array of Arr2JAIImagingOpException;
 
-  JLVirtualMachineError = class;
-  Arr1JLVirtualMachineError = array of JLVirtualMachineError;
-  Arr2JLVirtualMachineError = array of Arr1JLVirtualMachineError;
-  Arr3JLVirtualMachineError = array of Arr2JLVirtualMachineError;
-
   JSInvalidParameterException = class;
   Arr1JSInvalidParameterException = array of JSInvalidParameterException;
   Arr2JSInvalidParameterException = array of Arr1JSInvalidParameterException;
   Arr3JSInvalidParameterException = array of Arr2JSInvalidParameterException;
 
+  JLVirtualMachineError = class;
+  Arr1JLVirtualMachineError = array of JLVirtualMachineError;
+  Arr2JLVirtualMachineError = array of Arr1JLVirtualMachineError;
+  Arr3JLVirtualMachineError = array of Arr2JLVirtualMachineError;
+
   OJXDIDDOMTransform = class;
   Arr1OJXDIDDOMTransform = array of OJXDIDDOMTransform;
   Arr2OJXDIDDOMTransform = array of Arr1OJXDIDDOMTransform;
@@ -4850,16 +4825,16 @@ type
   Arr2JADDragSource = array of Arr1JADDragSource;
   Arr3JADDragSource = array of Arr2JADDragSource;
 
-  JAPolygon = class;
-  Arr1JAPolygon = array of JAPolygon;
-  Arr2JAPolygon = array of Arr1JAPolygon;
-  Arr3JAPolygon = array of Arr2JAPolygon;
-
   JUCAAtomicInteger = class;
   Arr1JUCAAtomicInteger = array of JUCAAtomicInteger;
   Arr2JUCAAtomicInteger = array of Arr1JUCAAtomicInteger;
   Arr3JUCAAtomicInteger = array of Arr2JUCAAtomicInteger;
 
+  JAPolygon = class;
+  Arr1JAPolygon = array of JAPolygon;
+  Arr2JAPolygon = array of Arr1JAPolygon;
+  Arr3JAPolygon = array of Arr2JAPolygon;
+
   JSSecureRandom = class;
   Arr1JSSecureRandom = array of JSSecureRandom;
   Arr2JSSecureRandom = array of Arr1JSSecureRandom;
@@ -5280,11 +5255,6 @@ type
   Arr2JSTRRTFParser = array of Arr1JSTRRTFParser;
   Arr3JSTRRTFParser = array of Arr2JSTRRTFParser;
 
-  JIIOException = class;
-  Arr1JIIOException = array of JIIOException;
-  Arr2JIIOException = array of Arr1JIIOException;
-  Arr3JIIOException = array of Arr2JIIOException;
-
   JUXMLUtils = class;
   Arr1JUXMLUtils = array of JUXMLUtils;
   Arr2JUXMLUtils = array of Arr1JUXMLUtils;
@@ -6070,11 +6040,6 @@ type
   Arr2JTAttributedString = array of Arr1JTAttributedString;
   Arr3JTAttributedString = array of Arr2JTAttributedString;
 
-  JNCCoderMalfunctionError = class;
-  Arr1JNCCoderMalfunctionError = array of JNCCoderMalfunctionError;
-  Arr2JNCCoderMalfunctionError = array of Arr1JNCCoderMalfunctionError;
-  Arr3JNCCoderMalfunctionError = array of Arr2JNCCoderMalfunctionError;
-
   OOCNInvalidNameHolder = class;
   Arr1OOCNInvalidNameHolder = array of OOCNInvalidNameHolder;
   Arr2OOCNInvalidNameHolder = array of Arr1OOCNInvalidNameHolder;
@@ -6335,16 +6300,16 @@ type
   Arr2OOCBindingIteratorHolder = array of Arr1OOCBindingIteratorHolder;
   Arr3OOCBindingIteratorHolder = array of Arr2OOCBindingIteratorHolder;
 
-  JAPFilerException = class;
-  Arr1JAPFilerException = array of JAPFilerException;
-  Arr2JAPFilerException = array of Arr1JAPFilerException;
-  Arr3JAPFilerException = array of Arr2JAPFilerException;
-
   JUCExchanger = class;
   Arr1JUCExchanger = array of JUCExchanger;
   Arr2JUCExchanger = array of Arr1JUCExchanger;
   Arr3JUCExchanger = array of Arr2JUCExchanger;
 
+  JAPFilerException = class;
+  Arr1JAPFilerException = array of JAPFilerException;
+  Arr2JAPFilerException = array of Arr1JAPFilerException;
+  Arr3JAPFilerException = array of Arr2JAPFilerException;
+
   JMMBeanServerNotification = class;
   Arr1JMMBeanServerNotification = array of JMMBeanServerNotification;
   Arr2JMMBeanServerNotification = array of Arr1JMMBeanServerNotification;
@@ -6845,16 +6810,6 @@ type
   Arr2JAMenu = array of Arr1JAMenu;
   Arr3JAMenu = array of Arr2JAMenu;
 
-  JNCUnmappableCharacterException = class;
-  Arr1JNCUnmappableCharacterException = array of JNCUnmappableCharacterException;
-  Arr2JNCUnmappableCharacterException = array of Arr1JNCUnmappableCharacterException;
-  Arr3JNCUnmappableCharacterException = array of Arr2JNCUnmappableCharacterException;
-
-  JNCMalformedInputException = class;
-  Arr1JNCMalformedInputException = array of JNCMalformedInputException;
-  Arr2JNCMalformedInputException = array of Arr1JNCMalformedInputException;
-  Arr3JNCMalformedInputException = array of Arr2JNCMalformedInputException;
-
   OWDLLSException = class;
   Arr1OWDLLSException = array of OWDLLSException;
   Arr2OWDLLSException = array of Arr1OWDLLSException;
@@ -6910,16 +6865,16 @@ type
   Arr2JNByteBufferAsIntBufferRL = array of Arr1JNByteBufferAsIntBufferRL;
   Arr3JNByteBufferAsIntBufferRL = array of Arr2JNByteBufferAsIntBufferRL;
 
-  JXVSchemaFactoryLoader = class;
-  Arr1JXVSchemaFactoryLoader = array of JXVSchemaFactoryLoader;
-  Arr2JXVSchemaFactoryLoader = array of Arr1JXVSchemaFactoryLoader;
-  Arr3JXVSchemaFactoryLoader = array of Arr2JXVSchemaFactoryLoader;
-
   JTRuleBasedCollator = class;
   Arr1JTRuleBasedCollator = array of JTRuleBasedCollator;
   Arr2JTRuleBasedCollator = array of Arr1JTRuleBasedCollator;
   Arr3JTRuleBasedCollator = array of Arr2JTRuleBasedCollator;
 
+  JXVSchemaFactoryLoader = class;
+  Arr1JXVSchemaFactoryLoader = array of JXVSchemaFactoryLoader;
+  Arr2JXVSchemaFactoryLoader = array of Arr1JXVSchemaFactoryLoader;
+  Arr3JXVSchemaFactoryLoader = array of Arr2JXVSchemaFactoryLoader;
+
   JSPBBasicTextPaneUI = class;
   Arr1JSPBBasicTextPaneUI = array of JSPBBasicTextPaneUI;
   Arr2JSPBBasicTextPaneUI = array of Arr1JSPBBasicTextPaneUI;
@@ -7435,16 +7390,16 @@ type
   Arr2JLConditionalSpecialCasing = array of Arr1JLConditionalSpecialCasing;
   Arr3JLConditionalSpecialCasing = array of Arr2JLConditionalSpecialCasing;
 
-  JIObjectInputStream = class;
-  Arr1JIObjectInputStream = array of JIObjectInputStream;
-  Arr2JIObjectInputStream = array of Arr1JIObjectInputStream;
-  Arr3JIObjectInputStream = array of Arr2JIObjectInputStream;
-
   JTFormat = class;
   Arr1JTFormat = array of JTFormat;
   Arr2JTFormat = array of Arr1JTFormat;
   Arr3JTFormat = array of Arr2JTFormat;
 
+  JIObjectInputStream = class;
+  Arr1JIObjectInputStream = array of JIObjectInputStream;
+  Arr2JIObjectInputStream = array of Arr1JIObjectInputStream;
+  Arr3JIObjectInputStream = array of Arr2JIObjectInputStream;
+
   JSDigestException = class;
   Arr1JSDigestException = array of JSDigestException;
   Arr2JSDigestException = array of Arr1JSDigestException;
@@ -7870,16 +7825,16 @@ type
   Arr2JCSDHPublicKeySpec = array of Arr1JCSDHPublicKeySpec;
   Arr3JCSDHPublicKeySpec = array of Arr2JCSDHPublicKeySpec;
 
-  JMRJMXConnectorFactory = class;
-  Arr1JMRJMXConnectorFactory = array of JMRJMXConnectorFactory;
-  Arr2JMRJMXConnectorFactory = array of Arr1JMRJMXConnectorFactory;
-  Arr3JMRJMXConnectorFactory = array of Arr2JMRJMXConnectorFactory;
-
   JLRReflectAccess = class;
   Arr1JLRReflectAccess = array of JLRReflectAccess;
   Arr2JLRReflectAccess = array of Arr1JLRReflectAccess;
   Arr3JLRReflectAccess = array of Arr2JLRReflectAccess;
 
+  JMRJMXConnectorFactory = class;
+  Arr1JMRJMXConnectorFactory = array of JMRJMXConnectorFactory;
+  Arr2JMRJMXConnectorFactory = array of Arr1JMRJMXConnectorFactory;
+  Arr3JMRJMXConnectorFactory = array of Arr2JMRJMXConnectorFactory;
+
   OOCTRANSACTION_MODE = class;
   Arr1OOCTRANSACTION_MODE = array of OOCTRANSACTION_MODE;
   Arr2OOCTRANSACTION_MODE = array of Arr1OOCTRANSACTION_MODE;
@@ -8080,11 +8035,6 @@ type
   Arr2JSPMMetalScrollPaneUI = array of Arr1JSPMMetalScrollPaneUI;
   Arr3JSPMMetalScrollPaneUI = array of Arr2JSPMMetalScrollPaneUI;
 
-  JNCCharsetEncoder = class;
-  Arr1JNCCharsetEncoder = array of JNCCharsetEncoder;
-  Arr2JNCCharsetEncoder = array of Arr1JNCCharsetEncoder;
-  Arr3JNCCharsetEncoder = array of Arr2JNCCharsetEncoder;
-
   JXTSStreamResult = class;
   Arr1JXTSStreamResult = array of JXTSStreamResult;
   Arr2JXTSStreamResult = array of Arr1JXTSStreamResult;
@@ -8410,16 +8360,16 @@ type
   Arr2JBBBeanContextSupport = array of Arr1JBBBeanContextSupport;
   Arr3JBBBeanContextSupport = array of Arr2JBBBeanContextSupport;
 
-  JUJJarException = class;
-  Arr1JUJJarException = array of JUJJarException;
-  Arr2JUJJarException = array of Arr1JUJJarException;
-  Arr3JUJJarException = array of Arr2JUJJarException;
-
   JSCardPermission = class;
   Arr1JSCardPermission = array of JSCardPermission;
   Arr2JSCardPermission = array of Arr1JSCardPermission;
   Arr3JSCardPermission = array of Arr2JSCardPermission;
 
+  JUJJarException = class;
+  Arr1JUJJarException = array of JUJJarException;
+  Arr2JUJJarException = array of Arr1JUJJarException;
+  Arr3JUJJarException = array of Arr2JUJJarException;
+
   JPASPrinterResolution = class;
   Arr1JPASPrinterResolution = array of JPASPrinterResolution;
   Arr2JPASPrinterResolution = array of Arr1JPASPrinterResolution;
@@ -8705,11 +8655,6 @@ type
   Arr2JSPMMetalComboBoxIcon = array of Arr1JSPMMetalComboBoxIcon;
   Arr3JSPMMetalComboBoxIcon = array of Arr2JSPMMetalComboBoxIcon;
 
-  JNCCharset = class;
-  Arr1JNCCharset = array of JNCCharset;
-  Arr2JNCCharset = array of Arr1JNCCharset;
-  Arr3JNCCharset = array of Arr2JNCCharset;
-
   JBReflectionUtils = class;
   Arr1JBReflectionUtils = array of JBReflectionUtils;
   Arr2JBReflectionUtils = array of Arr1JBReflectionUtils;
@@ -9990,11 +9935,6 @@ type
   Arr2JXWSFactoryFinder = array of Arr1JXWSFactoryFinder;
   Arr3JXWSFactoryFinder = array of Arr2JXWSFactoryFinder;
 
-  JLIllegalStateException = class;
-  Arr1JLIllegalStateException = array of JLIllegalStateException;
-  Arr2JLIllegalStateException = array of Arr1JLIllegalStateException;
-  Arr3JLIllegalStateException = array of Arr2JLIllegalStateException;
-
   JUTimeZone = class;
   Arr1JUTimeZone = array of JUTimeZone;
   Arr2JUTimeZone = array of Arr1JUTimeZone;
@@ -10030,21 +9970,16 @@ type
   Arr2OOCOctetSeqHelper = array of Arr1OOCOctetSeqHelper;
   Arr3OOCOctetSeqHelper = array of Arr2OOCOctetSeqHelper;
 
-  JNByteBuffer = class;
-  Arr1JNByteBuffer = array of JNByteBuffer;
-  Arr2JNByteBuffer = array of Arr1JNByteBuffer;
-  Arr3JNByteBuffer = array of Arr2JNByteBuffer;
+  JNDInvalidSearchFilterException = class;
+  Arr1JNDInvalidSearchFilterException = array of JNDInvalidSearchFilterException;
+  Arr2JNDInvalidSearchFilterException = array of Arr1JNDInvalidSearchFilterException;
+  Arr3JNDInvalidSearchFilterException = array of Arr2JNDInvalidSearchFilterException;
 
   JNCAlreadyConnectedException = class;
   Arr1JNCAlreadyConnectedException = array of JNCAlreadyConnectedException;
   Arr2JNCAlreadyConnectedException = array of Arr1JNCAlreadyConnectedException;
   Arr3JNCAlreadyConnectedException = array of Arr2JNCAlreadyConnectedException;
 
-  JNDInvalidSearchFilterException = class;
-  Arr1JNDInvalidSearchFilterException = array of JNDInvalidSearchFilterException;
-  Arr2JNDInvalidSearchFilterException = array of Arr1JNDInvalidSearchFilterException;
-  Arr3JNDInvalidSearchFilterException = array of Arr2JNDInvalidSearchFilterException;
-
   JXBAXmlAccessType = class;
   Arr1JXBAXmlAccessType = array of JXBAXmlAccessType;
   Arr2JXBAXmlAccessType = array of Arr1JXBAXmlAccessType;
@@ -10220,16 +10155,16 @@ type
   Arr2JAPPageFormat = array of Arr1JAPPageFormat;
   Arr3JAPPageFormat = array of Arr2JAPPageFormat;
 
-  JNUnknownHostException = class;
-  Arr1JNUnknownHostException = array of JNUnknownHostException;
-  Arr2JNUnknownHostException = array of Arr1JNUnknownHostException;
-  Arr3JNUnknownHostException = array of Arr2JNUnknownHostException;
-
   JUJJavaUtilJarAccessImpl = class;
   Arr1JUJJavaUtilJarAccessImpl = array of JUJJavaUtilJarAccessImpl;
   Arr2JUJJavaUtilJarAccessImpl = array of Arr1JUJJavaUtilJarAccessImpl;
   Arr3JUJJavaUtilJarAccessImpl = array of Arr2JUJJavaUtilJarAccessImpl;
 
+  JNUnknownHostException = class;
+  Arr1JNUnknownHostException = array of JNUnknownHostException;
+  Arr2JNUnknownHostException = array of Arr1JNUnknownHostException;
+  Arr3JNUnknownHostException = array of Arr2JNUnknownHostException;
+
   OJXDIDigesterOutputStream = class;
   Arr1OJXDIDigesterOutputStream = array of OJXDIDigesterOutputStream;
   Arr2OJXDIDigesterOutputStream = array of Arr1OJXDIDigesterOutputStream;
@@ -10335,16 +10270,16 @@ type
   Arr2JLRReflectPermission = array of Arr1JLRReflectPermission;
   Arr3JLRReflectPermission = array of Arr2JLRReflectPermission;
 
-  JRUnknownHostException = class;
-  Arr1JRUnknownHostException = array of JRUnknownHostException;
-  Arr2JRUnknownHostException = array of Arr1JRUnknownHostException;
-  Arr3JRUnknownHostException = array of Arr2JRUnknownHostException;
-
   JBjavax_swing_JTabbedPane_PersistenceDelegate = class;
   Arr1JBjavax_swing_JTabbedPane_PersistenceDelegate = array of JBjavax_swing_JTabbedPane_PersistenceDelegate;
   Arr2JBjavax_swing_JTabbedPane_PersistenceDelegate = array of Arr1JBjavax_swing_JTabbedPane_PersistenceDelegate;
   Arr3JBjavax_swing_JTabbedPane_PersistenceDelegate = array of Arr2JBjavax_swing_JTabbedPane_PersistenceDelegate;
 
+  JRUnknownHostException = class;
+  Arr1JRUnknownHostException = array of JRUnknownHostException;
+  Arr2JRUnknownHostException = array of Arr1JRUnknownHostException;
+  Arr3JRUnknownHostException = array of Arr2JRUnknownHostException;
+
   JNByteBufferAsFloatBufferB = class;
   Arr1JNByteBufferAsFloatBufferB = array of JNByteBufferAsFloatBufferB;
   Arr2JNByteBufferAsFloatBufferB = array of Arr1JNByteBufferAsFloatBufferB;
@@ -10715,11 +10650,6 @@ type
   Arr2OOPIdUniquenessPolicyValue = array of Arr1OOPIdUniquenessPolicyValue;
   Arr3OOPIdUniquenessPolicyValue = array of Arr2OOPIdUniquenessPolicyValue;
 
-  JLUnsupportedOperationException = class;
-  Arr1JLUnsupportedOperationException = array of JLUnsupportedOperationException;
-  Arr2JLUnsupportedOperationException = array of Arr1JLUnsupportedOperationException;
-  Arr3JLUnsupportedOperationException = array of Arr2JLUnsupportedOperationException;
-
   JAGridBagLayoutInfo = class;
   Arr1JAGridBagLayoutInfo = array of JAGridBagLayoutInfo;
   Arr2JAGridBagLayoutInfo = array of Arr1JAGridBagLayoutInfo;
@@ -10950,11 +10880,6 @@ type
   Arr2JPASOrientationRequested = array of Arr1JPASOrientationRequested;
   Arr3JPASOrientationRequested = array of Arr2JPASOrientationRequested;
 
-  JNUnknownServiceException = class;
-  Arr1JNUnknownServiceException = array of JNUnknownServiceException;
-  Arr2JNUnknownServiceException = array of Arr1JNUnknownServiceException;
-  Arr3JNUnknownServiceException = array of Arr2JNUnknownServiceException;
-
   JLVoid = class;
   Arr1JLVoid = array of JLVoid;
   Arr2JLVoid = array of Arr1JLVoid;
@@ -10965,6 +10890,11 @@ type
   Arr2JIImageReader = array of Arr1JIImageReader;
   Arr3JIImageReader = array of Arr2JIImageReader;
 
+  JNUnknownServiceException = class;
+  Arr1JNUnknownServiceException = array of JNUnknownServiceException;
+  Arr2JNUnknownServiceException = array of Arr1JNUnknownServiceException;
+  Arr3JNUnknownServiceException = array of Arr2JNUnknownServiceException;
+
   OOCOInvalidName = class;
   Arr1OOCOInvalidName = array of OOCOInvalidName;
   Arr2OOCOInvalidName = array of Arr1OOCOInvalidName;
@@ -11160,16 +11090,16 @@ type
   Arr2JSTimerQueue = array of Arr1JSTimerQueue;
   Arr3JSTimerQueue = array of Arr2JSTimerQueue;
 
-  JUFormatterClosedException = class;
-  Arr1JUFormatterClosedException = array of JUFormatterClosedException;
-  Arr2JUFormatterClosedException = array of Arr1JUFormatterClosedException;
-  Arr3JUFormatterClosedException = array of Arr2JUFormatterClosedException;
-
   OJXDIDDOMStructure = class;
   Arr1OJXDIDDOMStructure = array of OJXDIDDOMStructure;
   Arr2OJXDIDDOMStructure = array of Arr1OJXDIDDOMStructure;
   Arr3OJXDIDDOMStructure = array of Arr2OJXDIDDOMStructure;
 
+  JUFormatterClosedException = class;
+  Arr1JUFormatterClosedException = array of JUFormatterClosedException;
+  Arr2JUFormatterClosedException = array of Arr1JUFormatterClosedException;
+  Arr3JUFormatterClosedException = array of Arr2JUFormatterClosedException;
+
   JSPBBasicToolBarSeparatorUI = class;
   Arr1JSPBBasicToolBarSeparatorUI = array of JSPBBasicToolBarSeparatorUI;
   Arr2JSPBBasicToolBarSeparatorUI = array of Arr1JSPBBasicToolBarSeparatorUI;
@@ -11665,16 +11595,16 @@ type
   Arr2JNCPipe = array of Arr1JNCPipe;
   Arr3JNCPipe = array of Arr2JNCPipe;
 
-  JNReadOnlyBufferException = class;
-  Arr1JNReadOnlyBufferException = array of JNReadOnlyBufferException;
-  Arr2JNReadOnlyBufferException = array of Arr1JNReadOnlyBufferException;
-  Arr3JNReadOnlyBufferException = array of Arr2JNReadOnlyBufferException;
-
   JSTHPElement = class;
   Arr1JSTHPElement = array of JSTHPElement;
   Arr2JSTHPElement = array of Arr1JSTHPElement;
   Arr3JSTHPElement = array of Arr2JSTHPElement;
 
+  JNReadOnlyBufferException = class;
+  Arr1JNReadOnlyBufferException = array of JNReadOnlyBufferException;
+  Arr2JNReadOnlyBufferException = array of Arr1JNReadOnlyBufferException;
+  Arr3JNReadOnlyBufferException = array of Arr2JNReadOnlyBufferException;
+
   JXBJAXBException = class;
   Arr1JXBJAXBException = array of JXBJAXBException;
   Arr2JXBJAXBException = array of Arr1JXBJAXBException;
@@ -12485,16 +12415,16 @@ type
   Arr2JSTVariableHeightLayoutCache = array of Arr1JSTVariableHeightLayoutCache;
   Arr3JSTVariableHeightLayoutCache = array of Arr2JSTVariableHeightLayoutCache;
 
-  JUJManifest = class;
-  Arr1JUJManifest = array of JUJManifest;
-  Arr2JUJManifest = array of Arr1JUJManifest;
-  Arr3JUJManifest = array of Arr2JUJManifest;
-
   JUEnumMap = class;
   Arr1JUEnumMap = array of JUEnumMap;
   Arr2JUEnumMap = array of Arr1JUEnumMap;
   Arr3JUEnumMap = array of Arr2JUEnumMap;
 
+  JUJManifest = class;
+  Arr1JUJManifest = array of JUJManifest;
+  Arr2JUJManifest = array of Arr1JUJManifest;
+  Arr3JUJManifest = array of Arr2JUJManifest;
+
   JLVerifyError = class;
   Arr1JLVerifyError = array of JLVerifyError;
   Arr2JLVerifyError = array of Arr1JLVerifyError;
@@ -12605,11 +12535,6 @@ type
   Arr2JSPMMetalDesktopIconUI = array of Arr1JSPMMetalDesktopIconUI;
   Arr3JSPMMetalDesktopIconUI = array of Arr2JSPMMetalDesktopIconUI;
 
-  JNCCharsetDecoder = class;
-  Arr1JNCCharsetDecoder = array of JNCCharsetDecoder;
-  Arr2JNCCharsetDecoder = array of Arr1JNCCharsetDecoder;
-  Arr3JNCCharsetDecoder = array of Arr2JNCCharsetDecoder;
-
   JSTGlyphView = class;
   Arr1JSTGlyphView = array of JSTGlyphView;
   Arr2JSTGlyphView = array of Arr1JSTGlyphView;
@@ -12675,11 +12600,6 @@ type
   Arr2JXPDocumentBuilder = array of Arr1JXPDocumentBuilder;
   Arr3JXPDocumentBuilder = array of Arr2JXPDocumentBuilder;
 
-  JNCUnsupportedCharsetException = class;
-  Arr1JNCUnsupportedCharsetException = array of JNCUnsupportedCharsetException;
-  Arr2JNCUnsupportedCharsetException = array of Arr1JNCUnsupportedCharsetException;
-  Arr3JNCUnsupportedCharsetException = array of Arr2JNCUnsupportedCharsetException;
-
   JSDebugGraphicsFilter = class;
   Arr1JSDebugGraphicsFilter = array of JSDebugGraphicsFilter;
   Arr2JSDebugGraphicsFilter = array of Arr1JSDebugGraphicsFilter;
@@ -12775,11 +12695,6 @@ type
   Arr2JAGPoint2D = array of Arr1JAGPoint2D;
   Arr3JAGPoint2D = array of Arr2JAGPoint2D;
 
-  JNBuffer = class;
-  Arr1JNBuffer = array of JNBuffer;
-  Arr2JNBuffer = array of Arr1JNBuffer;
-  Arr3JNBuffer = array of Arr2JNBuffer;
-
   JSEListDataEvent = class;
   Arr1JSEListDataEvent = array of JSEListDataEvent;
   Arr2JSEListDataEvent = array of Arr1JSEListDataEvent;
@@ -12975,16 +12890,16 @@ type
   Arr2JSPBorderUIResource = array of Arr1JSPBorderUIResource;
   Arr3JSPBorderUIResource = array of Arr2JSPBorderUIResource;
 
-  JNLSortKey = class;
-  Arr1JNLSortKey = array of JNLSortKey;
-  Arr2JNLSortKey = array of Arr1JNLSortKey;
-  Arr3JNLSortKey = array of Arr2JNLSortKey;
-
   JSCX509CRLSelector = class;
   Arr1JSCX509CRLSelector = array of JSCX509CRLSelector;
   Arr2JSCX509CRLSelector = array of Arr1JSCX509CRLSelector;
   Arr3JSCX509CRLSelector = array of Arr2JSCX509CRLSelector;
 
+  JNLSortKey = class;
+  Arr1JNLSortKey = array of JNLSortKey;
+  Arr2JNLSortKey = array of Arr1JNLSortKey;
+  Arr3JNLSortKey = array of Arr2JNLSortKey;
+
   OOCINVALID_TRANSACTION = class;
   Arr1OOCINVALID_TRANSACTION = array of OOCINVALID_TRANSACTION;
   Arr2OOCINVALID_TRANSACTION = array of Arr1OOCINVALID_TRANSACTION;
@@ -13360,16 +13275,16 @@ type
   Arr2JTAttributeEntry = array of Arr1JTAttributeEntry;
   Arr3JTAttributeEntry = array of Arr2JTAttributeEntry;
 
-  JBDefaultPersistenceDelegate = class;
-  Arr1JBDefaultPersistenceDelegate = array of JBDefaultPersistenceDelegate;
-  Arr2JBDefaultPersistenceDelegate = array of Arr1JBDefaultPersistenceDelegate;
-  Arr3JBDefaultPersistenceDelegate = array of Arr2JBDefaultPersistenceDelegate;
-
   JURPatternSyntaxException = class;
   Arr1JURPatternSyntaxException = array of JURPatternSyntaxException;
   Arr2JURPatternSyntaxException = array of Arr1JURPatternSyntaxException;
   Arr3JURPatternSyntaxException = array of Arr2JURPatternSyntaxException;
 
+  JBDefaultPersistenceDelegate = class;
+  Arr1JBDefaultPersistenceDelegate = array of JBDefaultPersistenceDelegate;
+  Arr2JBDefaultPersistenceDelegate = array of Arr1JBDefaultPersistenceDelegate;
+  Arr3JBDefaultPersistenceDelegate = array of Arr2JBDefaultPersistenceDelegate;
+
   JPAHashPrintRequestAttributeSet = class;
   Arr1JPAHashPrintRequestAttributeSet = array of JPAHashPrintRequestAttributeSet;
   Arr2JPAHashPrintRequestAttributeSet = array of Arr1JPAHashPrintRequestAttributeSet;
@@ -13505,16 +13420,16 @@ type
   Arr2JSPBBasicIconFactory = array of Arr1JSPBBasicIconFactory;
   Arr3JSPBBasicIconFactory = array of Arr2JSPBBasicIconFactory;
 
-  JNCNoConnectionPendingException = class;
-  Arr1JNCNoConnectionPendingException = array of JNCNoConnectionPendingException;
-  Arr2JNCNoConnectionPendingException = array of Arr1JNCNoConnectionPendingException;
-  Arr3JNCNoConnectionPendingException = array of Arr2JNCNoConnectionPendingException;
-
   JNInet4AddressImpl = class;
   Arr1JNInet4AddressImpl = array of JNInet4AddressImpl;
   Arr2JNInet4AddressImpl = array of Arr1JNInet4AddressImpl;
   Arr3JNInet4AddressImpl = array of Arr2JNInet4AddressImpl;
 
+  JNCNoConnectionPendingException = class;
+  Arr1JNCNoConnectionPendingException = array of JNCNoConnectionPendingException;
+  Arr2JNCNoConnectionPendingException = array of Arr1JNCNoConnectionPendingException;
+  Arr3JNCNoConnectionPendingException = array of Arr2JNCNoConnectionPendingException;
+
   JISFileImageOutputStream = class;
   Arr1JISFileImageOutputStream = array of JISFileImageOutputStream;
   Arr2JISFileImageOutputStream = array of Arr1JISFileImageOutputStream;
@@ -13685,16 +13600,16 @@ type
   Arr2JLRReference = array of Arr1JLRReference;
   Arr3JLRReference = array of Arr2JLRReference;
 
-  JLMUSimpleElementVisitor6 = class;
-  Arr1JLMUSimpleElementVisitor6 = array of JLMUSimpleElementVisitor6;
-  Arr2JLMUSimpleElementVisitor6 = array of Arr1JLMUSimpleElementVisitor6;
-  Arr3JLMUSimpleElementVisitor6 = array of Arr2JLMUSimpleElementVisitor6;
-
   JUJJarVerifier = class;
   Arr1JUJJarVerifier = array of JUJJarVerifier;
   Arr2JUJJarVerifier = array of Arr1JUJJarVerifier;
   Arr3JUJJarVerifier = array of Arr2JUJJarVerifier;
 
+  JLMUSimpleElementVisitor6 = class;
+  Arr1JLMUSimpleElementVisitor6 = array of JLMUSimpleElementVisitor6;
+  Arr2JLMUSimpleElementVisitor6 = array of Arr1JLMUSimpleElementVisitor6;
+  Arr3JLMUSimpleElementVisitor6 = array of Arr2JLMUSimpleElementVisitor6;
+
   JSTTableColumn = class;
   Arr1JSTTableColumn = array of JSTTableColumn;
   Arr2JSTTableColumn = array of Arr1JSTTableColumn;
@@ -14425,11 +14340,6 @@ type
   Arr2JSSECPoint = array of Arr1JSSECPoint;
   Arr3JSSECPoint = array of Arr2JSSECPoint;
 
-  JNCIllegalCharsetNameException = class;
-  Arr1JNCIllegalCharsetNameException = array of JNCIllegalCharsetNameException;
-  Arr2JNCIllegalCharsetNameException = array of Arr1JNCIllegalCharsetNameException;
-  Arr3JNCIllegalCharsetNameException = array of Arr2JNCIllegalCharsetNameException;
-
   JSTHPTagElement = class;
   Arr1JSTHPTagElement = array of JSTHPTagElement;
   Arr2JSTHPTagElement = array of Arr1JSTHPTagElement;
@@ -14645,16 +14555,16 @@ type
   Arr2JLIllegalAccessError = array of Arr1JLIllegalAccessError;
   Arr3JLIllegalAccessError = array of Arr2JLIllegalAccessError;
 
-  JAIllegalComponentStateException = class;
-  Arr1JAIllegalComponentStateException = array of JAIllegalComponentStateException;
-  Arr2JAIllegalComponentStateException = array of Arr1JAIllegalComponentStateException;
-  Arr3JAIllegalComponentStateException = array of Arr2JAIllegalComponentStateException;
-
   JLMMemoryNotificationInfo = class;
   Arr1JLMMemoryNotificationInfo = array of JLMMemoryNotificationInfo;
   Arr2JLMMemoryNotificationInfo = array of Arr1JLMMemoryNotificationInfo;
   Arr3JLMMemoryNotificationInfo = array of Arr2JLMMemoryNotificationInfo;
 
+  JAIllegalComponentStateException = class;
+  Arr1JAIllegalComponentStateException = array of JAIllegalComponentStateException;
+  Arr2JAIllegalComponentStateException = array of Arr1JAIllegalComponentStateException;
+  Arr3JAIllegalComponentStateException = array of Arr2JAIllegalComponentStateException;
+
   JMRRRMIIIOPServerImpl = class;
   Arr1JMRRRMIIIOPServerImpl = array of JMRRRMIIIOPServerImpl;
   Arr2JMRRRMIIIOPServerImpl = array of Arr1JMRRRMIIIOPServerImpl;
@@ -17075,11 +16985,6 @@ type
   Arr2JMOOpenMBeanOperationInfo = array of Arr1JMOOpenMBeanOperationInfo;
   Arr3JMOOpenMBeanOperationInfo = array of Arr2JMOOpenMBeanOperationInfo;
 
-  JLReadable = interface;
-  Arr1JLReadable = array of JLReadable;
-  Arr2JLReadable = array of Arr1JLReadable;
-  Arr3JLReadable = array of Arr2JLReadable;
-
   JAPProcessingEnvironment = interface;
   Arr1JAPProcessingEnvironment = array of JAPProcessingEnvironment;
   Arr2JAPProcessingEnvironment = array of Arr1JAPProcessingEnvironment;
@@ -17330,16 +17235,16 @@ type
   Arr2OWDText = array of Arr1OWDText;
   Arr3OWDText = array of Arr2OWDText;
 
-  JMPersistentMBean = interface;
-  Arr1JMPersistentMBean = array of JMPersistentMBean;
-  Arr2JMPersistentMBean = array of Arr1JMPersistentMBean;
-  Arr3JMPersistentMBean = array of Arr2JMPersistentMBean;
-
   JXCDSSignatureMethodParameterSpec = interface;
   Arr1JXCDSSignatureMethodParameterSpec = array of JXCDSSignatureMethodParameterSpec;
   Arr2JXCDSSignatureMethodParameterSpec = array of Arr1JXCDSSignatureMethodParameterSpec;
   Arr3JXCDSSignatureMethodParameterSpec = array of Arr2JXCDSSignatureMethodParameterSpec;
 
+  JMPersistentMBean = interface;
+  Arr1JMPersistentMBean = array of JMPersistentMBean;
+  Arr2JMPersistentMBean = array of Arr1JMPersistentMBean;
+  Arr3JMPersistentMBean = array of Arr2JMPersistentMBean;
+
   OWDHHTMLElement = interface;
   Arr1OWDHHTMLElement = array of OWDHHTMLElement;
   Arr2OWDHHTMLElement = array of Arr1OWDHHTMLElement;
@@ -20655,6 +20560,11 @@ type
   Arr2JLObject = array of Arr1JLObject;
   Arr3JLObject = array of Arr2JLObject;
 
+  JNByteBuffer = class external 'java.nio' name 'ByteBuffer';
+  Arr1JNByteBuffer = array of JNByteBuffer;
+  Arr2JNByteBuffer = array of Arr1JNByteBuffer;
+  Arr3JNByteBuffer = array of Arr2JNByteBuffer;
+
   JLEnum = class external 'java.lang' name 'Enum';
   Arr1JLEnum = array of JLEnum;
   Arr2JLEnum = array of Arr1JLEnum;
@@ -20680,11 +20590,21 @@ type
   Arr2JLRMethod = array of Arr1JLRMethod;
   Arr3JLRMethod = array of Arr2JLRMethod;
 
+  JIIOException = class external 'java.io' name 'IOException';
+  Arr1JIIOException = array of JIIOException;
+  Arr2JIIOException = array of Arr1JIIOException;
+  Arr3JIIOException = array of Arr2JIIOException;
+
   JLCharacter = class external 'java.lang' name 'Character';
   Arr1JLCharacter = array of JLCharacter;
   Arr2JLCharacter = array of Arr1JLCharacter;
   Arr3JLCharacter = array of Arr2JLCharacter;
 
+  JNBuffer = class external 'java.nio' name 'Buffer';
+  Arr1JNBuffer = array of JNBuffer;
+  Arr2JNBuffer = array of Arr1JNBuffer;
+  Arr3JNBuffer = array of Arr2JNBuffer;
+
   JMBigInteger = class external 'java.math' name 'BigInteger';
   Arr1JMBigInteger = array of JMBigInteger;
   Arr2JMBigInteger = array of Arr1JMBigInteger;
@@ -20695,11 +20615,26 @@ type
   Arr2JLBoolean = array of Arr1JLBoolean;
   Arr3JLBoolean = array of Arr2JLBoolean;
 
+  JNCCharsetDecoder = class external 'java.nio.charset' name 'CharsetDecoder';
+  Arr1JNCCharsetDecoder = array of JNCCharsetDecoder;
+  Arr2JNCCharsetDecoder = array of Arr1JNCCharsetDecoder;
+  Arr3JNCCharsetDecoder = array of Arr2JNCCharsetDecoder;
+
   JLLong = class external 'java.lang' name 'Long';
   Arr1JLLong = array of JLLong;
   Arr2JLLong = array of Arr1JLLong;
   Arr3JLLong = array of Arr2JLLong;
 
+  JNCCharset = class external 'java.nio.charset' name 'Charset';
+  Arr1JNCCharset = array of JNCCharset;
+  Arr2JNCCharset = array of Arr1JNCCharset;
+  Arr3JNCCharset = array of Arr2JNCCharset;
+
+  JNCharBuffer = class external 'java.nio' name 'CharBuffer';
+  Arr1JNCharBuffer = array of JNCharBuffer;
+  Arr2JNCharBuffer = array of Arr1JNCharBuffer;
+  Arr3JNCharBuffer = array of Arr2JNCharBuffer;
+
   JLThrowable = class external 'java.lang' name 'Throwable';
   Arr1JLThrowable = array of JLThrowable;
   Arr2JLThrowable = array of Arr1JLThrowable;
@@ -20715,6 +20650,11 @@ type
   Arr2JLLinkageError = array of Arr1JLLinkageError;
   Arr3JLLinkageError = array of Arr2JLLinkageError;
 
+  JNCCharsetEncoder = class external 'java.nio.charset' name 'CharsetEncoder';
+  Arr1JNCCharsetEncoder = array of JNCCharsetEncoder;
+  Arr2JNCCharsetEncoder = array of Arr1JNCCharsetEncoder;
+  Arr3JNCCharsetEncoder = array of Arr2JNCCharsetEncoder;
+
   JUAbstractCollection = class external 'java.util' name 'AbstractCollection';
   Arr1JUAbstractCollection = array of JUAbstractCollection;
   Arr2JUAbstractCollection = array of Arr1JUAbstractCollection;
@@ -20730,6 +20670,11 @@ type
   Arr2JUAbstractMap = array of Arr1JUAbstractMap;
   Arr3JUAbstractMap = array of Arr2JUAbstractMap;
 
+  JLUnsupportedOperationException = class external 'java.lang' name 'UnsupportedOperationException';
+  Arr1JLUnsupportedOperationException = array of JLUnsupportedOperationException;
+  Arr2JLUnsupportedOperationException = array of Arr1JLUnsupportedOperationException;
+  Arr3JLUnsupportedOperationException = array of Arr2JLUnsupportedOperationException;
+
   JUEnumSet = class external 'java.util' name 'EnumSet';
   Arr1JUEnumSet = array of JUEnumSet;
   Arr2JUEnumSet = array of Arr1JUEnumSet;
@@ -20765,6 +20710,16 @@ type
   Arr2JUBitSet = array of Arr1JUBitSet;
   Arr3JUBitSet = array of Arr2JUBitSet;
 
+  JLClass = class external 'java.lang' name 'Class';
+  Arr1JLClass = array of JLClass;
+  Arr2JLClass = array of Arr1JLClass;
+  Arr3JLClass = array of Arr2JLClass;
+
+  JLString = class external 'java.lang' name 'String';
+  Arr1JLString = array of JLString;
+  Arr2JLString = array of Arr1JLString;
+  Arr3JLString = array of Arr2JLString;
+
   JLIllegalArgumentException = class external 'java.lang' name 'IllegalArgumentException';
   Arr1JLIllegalArgumentException = array of JLIllegalArgumentException;
   Arr2JLIllegalArgumentException = array of Arr1JLIllegalArgumentException;
@@ -20775,16 +20730,6 @@ type
   Arr2JUAbstractSet = array of Arr1JUAbstractSet;
   Arr3JUAbstractSet = array of Arr2JUAbstractSet;
 
-  JLString = class external 'java.lang' name 'String';
-  Arr1JLString = array of JLString;
-  Arr2JLString = array of Arr1JLString;
-  Arr3JLString = array of Arr2JLString;
-
-  JLClass = class external 'java.lang' name 'Class';
-  Arr1JLClass = array of JLClass;
-  Arr2JLClass = array of Arr1JLClass;
-  Arr3JLClass = array of Arr2JLClass;
-
   JLFloat = class external 'java.lang' name 'Float';
   Arr1JLFloat = array of JLFloat;
   Arr2JLFloat = array of Arr1JLFloat;
@@ -20795,6 +20740,11 @@ type
   Arr2JLRuntimeException = array of Arr1JLRuntimeException;
   Arr3JLRuntimeException = array of Arr2JLRuntimeException;
 
+  JLIllegalStateException = class external 'java.lang' name 'IllegalStateException';
+  Arr1JLIllegalStateException = array of JLIllegalStateException;
+  Arr2JLIllegalStateException = array of Arr1JLIllegalStateException;
+  Arr3JLIllegalStateException = array of Arr2JLIllegalStateException;
+
   JLRAccessibleObject = class external 'java.lang.reflect' name 'AccessibleObject';
   Arr1JLRAccessibleObject = array of JLRAccessibleObject;
   Arr2JLRAccessibleObject = array of Arr1JLRAccessibleObject;
@@ -20875,6 +20825,11 @@ type
   Arr2JISerializable = array of Arr1JISerializable;
   Arr3JISerializable = array of Arr2JISerializable;
 
+  JLReadable = interface external 'java.lang' name 'Readable';
+  Arr1JLReadable = array of JLReadable;
+  Arr2JLReadable = array of Arr1JLReadable;
+  Arr3JLReadable = array of Arr2JLReadable;
+
 
   CSJSPWDesktopProperty = class external 'com.sun.java.swing.plaf.windows' name 'DesktopProperty'
   end;

+ 20 - 1
rtl/java/jsstrings.inc

@@ -341,6 +341,18 @@ end;
                               Str() Helpers
 *****************************************************************************}
 
+{ this is a bit of a hack: 'public name' aliases don't work yet on the JVM
+  target, so manually add the redirection from FPC_VAL_SINT_SHORTSTR
+  to the fpc_Val_SInt_ShortStr compilerproc since compilerprocs are all lower
+  case }
+{$ifndef FPC_HAS_INT_VAL_SINT_SHORTSTR}
+{$define FPC_HAS_INT_VAL_SINT_SHORTSTR}
+{ we need this for fpc_Val_SInt_Ansistr and fpc_Val_SInt_WideStr because }
+{ we have to pass the DestSize parameter on (JM)                         }
+Function int_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; out Code: ValSInt): ValSInt; [external name 'fpc_val_sint_shortstr'];
+{$endif FPC_HAS_INT_VAL_SINT_SHORTSTR}
+
+
 {$define FPC_HAS_SETSTRING_SHORTSTR}
 Procedure SetString (Out S : Shortstring; Buf : PChar; Len : SizeInt);
 begin
@@ -395,5 +407,12 @@ begin
 end;
 
 
-{ lie, implemented internally in the compiler }
+{ not based on Delphi-style rtti }
 {$define FPC_STR_ENUM_INTERN}
+function fpc_shortstr_enum_intern(enum: JLEnum; len:sizeint;out s:shortstring): longint;
+begin
+  s:=enum.toString;
+  if length(s)<len then
+    s:=space(len-length(s))+s;
+end;
+

+ 2 - 2
rtl/java/jsystemh.inc

@@ -759,12 +759,12 @@ const
 {$i dynarrh.inc}
 {$endif FPC_HAS_FEATURE_DYNARRAYS}
 *)
+
 { documenting compiler proc. is useless, they shouldn't be used by the user anyways }
-(*
 {$ifndef fpdocsystem}
 {$i compproc.inc}
 {$endif fpdocsystem}
-*)
+
 {*****************************************************************************
                                Heap
 *****************************************************************************}

+ 97 - 0
rtl/java/justringh.inc

@@ -0,0 +1,97 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2011 by Jonas Maebe,
+    member of the Free Pascal development team.
+
+    This file implements support routines for UnicodeStrings with FPC
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$define FPC_HAS_BUILTIN_WIDESTR_MANAGER}
+Type
+  TCollatorThreadVar = class(JLThreadLocal)
+   protected
+    function initialValue: JLObject; override;
+  end;
+
+  TCharsetDecoderThreadvar = class(JLThreadLocal)
+   protected
+    function initialValue: JLObject; override;
+  end;
+
+  TCharsetEncoderThreadvar = class(JLThreadLocal)
+   protected
+    function initialValue: JLObject; override;
+  end;
+
+  { hooks for internationalization
+    please add new procedures at the end, it makes it easier to detect new procedures }
+
+  TUnicodeStringManager = class(JLObject)
+   class var
+    collator: TCollatorThreadVar;
+    decoder: TCharsetDecoderThreadvar;
+    encoder: TCharsetEncoderThreadvar;
+
+    class constructor ClassCreate;
+
+    procedure Wide2AnsiMoveProc(source:pwidechar;var dest:ansistring;len:SizeInt); virtual;
+    procedure Ansi2WideMoveProc(source:pchar;var dest:widestring;len:SizeInt); virtual;
+
+    function UpperWideStringProc(const S: WideString): WideString; virtual;
+    function LowerWideStringProc(const S: WideString): WideString; virtual;
+    function CompareWideStringProc(const s1, s2 : WideString) : PtrInt; virtual;
+    function CompareTextWideStringProc(const s1, s2 : WideString): PtrInt; virtual;
+    { return value: number of code points in the string. Whenever an invalid
+      code point is encountered, all characters part of this invalid code point
+      are considered to form one "character" and the next character is
+      considered to be the start of a new (possibly also invalid) code point
+
+      Note: different signature compared to version in native targets: extra
+        "Index" parameter, since you cannot increment pchars to point to the
+        next character here }
+    function CharLengthPCharProc(const Str: PChar; Index: PtrInt): PtrInt; virtual;
+    { return value:
+      -1 if incomplete or invalid code point
+      0 if NULL character,
+      > 0 if that's the length in bytes of the code point
+
+      Note: different signature compared to version in native targets: extra
+        "Index" parameter, since you cannot increment pchars to point to the
+        next character here }
+    function CodePointLengthProc(const Str: PChar; Index, MaxLookAhead: PtrInt): Ptrint; virtual;
+
+    function UpperAnsiStringProc(const s : ansistring) : ansistring; virtual;
+    function LowerAnsiStringProc(const s : ansistring) : ansistring; virtual;
+    function CompareStrAnsiStringProc(const S1, S2: ansistring): PtrInt; virtual;
+    function CompareTextAnsiStringProc(const S1, S2: ansistring): PtrInt; virtual;
+    function StrCompAnsiStringProc(S1, S2: PChar): PtrInt; virtual;
+    function StrICompAnsiStringProc(S1, S2: PChar): PtrInt; virtual;
+    function StrLCompAnsiStringProc(S1, S2: PChar; MaxLen: PtrUInt): PtrInt; virtual;
+    function StrLICompAnsiStringProc(S1, S2: PChar; MaxLen: PtrUInt): PtrInt; virtual;
+    function StrLowerAnsiStringProc(Str: PChar): PChar; virtual;
+    function StrUpperAnsiStringProc(Str: PChar): PChar; virtual;
+
+    // not possible to automatically run code when new thread is started in the
+    // JVM -- and not needed either, because threadvars can do so when first
+    // accessed from a thread
+//    ThreadInitProc : procedure;
+//    ThreadFiniProc : procedure;
+
+    { this is only different on windows }
+    procedure Unicode2AnsiMoveProc(source:punicodechar;var dest:ansistring;len:SizeInt); virtual;
+    procedure Ansi2UnicodeMoveProc(source:pchar;var dest:unicodestring;len:SizeInt); virtual;
+    function UpperUnicodeStringProc(const S: UnicodeString): UnicodeString; virtual;
+    function LowerUnicodeStringProc(const S: UnicodeString): UnicodeString; virtual;
+    function CompareUnicodeStringProc(const s1, s2 : UnicodeString) : PtrInt; virtual;
+    function CompareTextUnicodeStringProc(const s1, s2 : UnicodeString): PtrInt; virtual;
+  end;
+
+

+ 1189 - 0
rtl/java/justrings.inc

@@ -0,0 +1,1189 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2005 by Florian Klaempfl,
+    Copyright (c) 2011 by Jonas Maebe,
+    members of the Free Pascal development team.
+
+    This file implements support routines for UTF-8 strings with FPC
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ unicodestring is a plain java.lang.String }
+{$define FPC_UNICODESTRING_TYPE_DEFINED}
+
+{$define FPC_HAS_DEFAULT_UNICODE_2_ANSI_MOVE}
+procedure DefaultUnicode2AnsiMove(source:punicodechar;var dest:ansistring;len:SizeInt);
+var
+  localencoder: JNCCharsetEncoder;
+  inbuf: JNCharBuffer;
+  outbuf: JNByteBuffer;
+begin
+  localencoder:=JNCCharsetEncoder(widestringmanager.encoder.get);
+  localencoder.onMalformedInput(JNCCodingErrorAction.fREPLACE);
+  localencoder.onUnmappableCharacter(JNCCodingErrorAction.fREPLACE);
+  inbuf:=JNCharBuffer.wrap(TJCharArray(source));
+  outbuf:=localencoder.encode(inbuf);
+  setlength(dest,outbuf.limit);
+  outbuf.get(TJByteArray(AnsiStringClass(dest).fdata),0,outbuf.limit);
+  { already null-terminated because of setlength }
+end;
+
+
+{$define FPC_HAS_DEFAULT_ANSI_2_UNICODE}
+procedure DefaultAnsi2UnicodeMove(source:pchar;var dest:unicodestring;len:SizeInt);
+var
+  localdecoder: JNCCharsetDecoder;
+  inbuf: JNByteBuffer;
+  outbuf: JNCharBuffer;
+begin
+  localdecoder:=JNCCharsetDecoder(widestringmanager.decoder.get);
+  localdecoder.onMalformedInput(JNCCodingErrorAction.fREPLACE);
+  localdecoder.onUnmappableCharacter(JNCCodingErrorAction.fREPLACE);
+  inbuf:=JNByteBuffer.wrap(TJByteArray(source));
+  outbuf:=localdecoder.decode(inbuf);
+  dest:=outbuf.toString;
+end;
+
+
+{
+  This file contains the implementation of the UnicodeString type,
+  which on the Java platforms is an alias for java.lang.String
+}
+
+{$define FPC_HAS_NEW_UNICODESTRING}
+Function NewUnicodeString(Len : SizeInt) : JLString;
+{
+  Allocate a new UnicodeString on the heap.
+  initialize it to zero length and reference count 1.
+}
+var
+  data: array of jchar;
+begin
+  setlength(data,len);
+  result:=JLString.create(data);
+end;
+
+
+{ lie, not required }
+{$define FPC_HAS_DISPOSE_UNICODESTRING}
+{$define FPC_HAS_UNICODESTR_DECR_REF}
+{$define FPC_HAS_UNICODESTR_INCR_REF}
+
+{$define FPC_HAS_UNICODESTR_TO_SHORTSTR}
+procedure fpc_UnicodeStr_To_ShortStr (out res: ShortString;const S2 : UnicodeString); [Public, alias: 'FPC_UNICODESTR_TO_SHORTSTR'];compilerproc;
+{
+  Converts a UnicodeString to a ShortString;
+}
+Var
+  Size : SizeInt;
+  temp : ansistring;
+begin
+  res:='';
+  Size:=Length(S2);
+  if Size>0 then
+    begin
+      temp:=s2;
+      res:=temp;
+    end;
+end;
+
+
+{$define FPC_HAS_SHORTSTR_TO_UNICODESTR}
+Function fpc_ShortStr_To_UnicodeStr (Const S2 : ShortString): UnicodeString;compilerproc;
+{
+  Converts a ShortString to a UnicodeString;
+}
+Var
+  Size : SizeInt;
+begin
+  result:='';
+  Size:=Length(S2);
+  if Size>0 then
+    result:=unicodestring(JLString.Create(TJByteArray(ShortstringClass(@S2).fdata),0,Size));
+end;
+
+
+{$define FPC_HAS_UNICODESTR_TO_ANSISTR}
+Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString): AnsiString; compilerproc;
+{
+  Converts a UnicodeString to an AnsiString
+}
+Var
+  Size : SizeInt;
+begin
+  result:=Ansistring(AnsistringClass.Create(s2));
+end;
+
+
+{$define FPC_HAS_ANSISTR_TO_UNICODESTR}
+Function fpc_AnsiStr_To_UnicodeStr (Const S2 : AnsiString): UnicodeString; compilerproc;
+{
+  Converts an AnsiString to a UnicodeString;
+}
+Var
+  Size : SizeInt;
+begin
+  if length(s2)=0 then
+    result:=''
+  else
+    result:=AnsistringClass(S2).toString;
+end;
+
+
+{$define FPC_HAS_UNICODESTR_TO_WIDESTR}
+Function fpc_UnicodeStr_To_WideStr (const S2 : UnicodeString): WideString; compilerproc;
+  begin
+    result:=s2;
+  end;
+
+
+{$define FPC_HAS_WIDESTR_TO_UNICODESTR}
+Function fpc_WideStr_To_UnicodeStr (Const S2 : WideString): UnicodeString; compilerproc;
+  begin
+    result:=s2;
+  end;
+
+
+{ lie, not used by the compiler }
+{$define FPC_HAS_PUNICODECHAR_TO_ANSISTR}
+{$define FPC_HAS_PUNICODECHAR_TO_UNICODESTR}
+
+
+{$define FPC_HAS_PWIDECHAR_TO_UNICODESTR}
+Function fpc_PWideChar_To_UnicodeStr(const p : pwidechar): unicodestring; compilerproc;
+var
+  Size : SizeInt;
+begin
+  result:='';
+  if p=nil then
+    exit;
+  size:=0;
+  while p[size]<>#0 do
+    inc(size);
+  Setlength(result,Size);
+  if Size>0 then
+    result:=JLString.Create(TJCharArray(p),0,Size);
+end;
+
+
+{ lie, not used by compiler }
+{$define FPC_HAS_PUNICODECHAR_TO_SHORTSTR}
+
+{$define FPC_HAS_PWIDECHAR_TO_ANSISTR}
+Function fpc_PWideChar_To_AnsiStr(const p : pwidechar): ansistring; compilerproc;
+begin
+  result:='';
+  if (p=nil) or
+     (p^=#0) then
+    exit;
+  result:=unicodestring(p);
+end;
+
+
+{$define FPC_HAS_PWIDECHAR_TO_SHORTSTR}
+procedure fpc_PWideChar_To_ShortStr(out res : shortstring;const p : pwidechar); compilerproc;
+begin
+  res:='';
+  if (p=nil) or
+     (p^=#0) then
+    exit;
+  res:=unicodestring(p);
+end;
+
+{ lie, not required for JVM target }
+{$define FPC_HAS_UNICODESTR_ASSIGN}
+
+
+{$define FPC_HAS_UNICODESTR_CONCAT}
+function fpc_UnicodeStr_Concat (const S1,S2 : UnicodeString): UnicodeString; compilerproc;
+Var
+  sb: JLStringBuilder;
+begin
+  { only assign if s1 or s2 is empty }
+  if (length(S1)=0) then
+    begin
+      result:=s2;
+      exit;
+    end;
+  if (length(S2)=0) then
+    begin
+      result:=s1;
+      exit;
+    end;
+  sb:=JLStringBuilder.create(S1);
+  sb.append(s2);
+  result:=sb.toString;
+end;
+
+
+{$define FPC_HAS_UNICODESTR_CONCAT_MULTI}
+function fpc_UnicodeStr_Concat_multi (const sarr:array of Unicodestring): unicodestring; compilerproc;
+Var
+  i  : Longint;
+  Size,NewSize : SizeInt;
+  sb: JLStringBuilder;
+begin
+  { First calculate size of the result so we can allocate a StringBuilder of
+    the right size }
+  NewSize:=0;
+  for i:=low(sarr) to high(sarr) do
+    inc(Newsize,length(sarr[i]));
+  sb:=JLStringBuilder.create(NewSize);
+  for i:=low(sarr) to high(sarr) do
+    begin
+      if length(sarr[i])>0 then
+        sb.append(sarr[i]);
+    end;
+  result:=sb.toString;
+end;
+
+
+{$define FPC_HAS_CHAR_TO_UCHAR}
+Function fpc_Char_To_UChar(const c : AnsiChar): UnicodeChar; compilerproc;
+var
+  str: JLString;
+  arr: array of jbyte;
+begin
+  setlength(arr,1);
+  arr[0]:=ord(c);
+  result:=JLString.create(arr,0,1).charAt(0);
+end;
+
+
+{$define FPC_HAS_CHAR_TO_UNICODESTR}
+Function fpc_Char_To_UnicodeStr(const c : AnsiChar): UnicodeString; compilerproc;
+{
+  Converts a AnsiChar to a UnicodeString;
+}
+var
+  str: JLString;
+  arr: array of jbyte;
+begin
+  setlength(arr,1);
+  arr[0]:=ord(c);
+  result:=JLString.create(arr,0,1);
+end;
+
+
+{$define FPC_HAS_UCHAR_TO_CHAR}
+Function fpc_UChar_To_Char(const c : UnicodeChar): AnsiChar; compilerproc;
+{
+  Converts a UnicodeChar to a AnsiChar;
+}
+var
+  arrb: array of jbyte;
+  arrw: array of jchar;
+  str: JLString;
+begin
+  setlength(arrw,1);
+  arrw[0]:=c;
+  str:=JLString.create(arrw);
+  arrb:=str.getbytes();
+  result:=chr(arrb[0]);
+end;
+
+
+{ lie, unused for this target since widechar = unicodechar }
+{$define FPC_HAS_WHCAR_TO_UNICODESTR}
+{$define FPC_HAS_CHAR_TO_WHCAR}
+{$define FPC_HAS_WCHAR_TO_CHAR}
+{$define FPC_HAS_WCHAR_TO_SHORTSTR}
+
+{$define FPC_HAS_UCHAR_TO_UNICODESTR}
+Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
+{
+  Converts a UnicodeChar to a UnicodeString;
+}
+var
+  arr: array[0..0] of UnicodeChar;
+begin
+  arr[0]:=c;
+  result:=JLString.create(arr);
+end;
+
+
+{$define FPC_HAS_UCHAR_TO_ANSISTR}
+Function fpc_UChar_To_AnsiStr(const c : UnicodeChar): AnsiString; compilerproc;
+{
+  Converts a UnicodeChar to a AnsiString;
+}
+var
+  u: unicodestring;
+begin
+  u:=c;
+  result:=u;
+end;
+
+
+{$define FPC_HAS_UCHAR_TO_SHORTSTR}
+procedure fpc_UChar_To_ShortStr(out res : shortstring;const c : UnicodeChar) compilerproc;
+{
+  Converts a UnicodeChar to a AnsiString;
+}
+var
+  u: unicodestring;
+begin
+  u:=c;
+  res:=u;
+end;
+
+
+{$define FPC_HAS_PCHAR_TO_UNICODESTR}
+Function fpc_PChar_To_UnicodeStr(const p : pchar): UnicodeString; compilerproc;
+var
+  i, len: longint;
+  arr: TAnsiCharArray;
+begin
+  arr:=TAnsiCharArray(p);
+  i:=0;
+  while arr[i]<>#0 do
+    inc(i);
+  if i<>0 then
+    result:=JLString.create(TJByteArray(arr),0,i)
+  else
+    result:=''
+end;
+
+
+{$define FPC_HAS_CHARARRAY_TO_UNICODESTR}
+Function fpc_CharArray_To_UnicodeStr(const arr: array of ansichar; zerobased: boolean = true): UnicodeString; compilerproc;
+var
+  i,j  : SizeInt;
+  localarr: array of jbyte;
+  foundnull: boolean;
+begin
+  if (zerobased) then
+    begin
+      if (arr[0]=#0) Then
+      begin
+        fpc_chararray_to_unicodestr := '';
+        exit;
+      end;
+      foundnull:=false;
+      for i:=low(arr) to high(arr) do
+        if arr[i]=#0 then
+          begin
+            foundnull:=true;
+            break;
+          end;
+      if not foundnull then
+        i := high(arr)+1;
+    end
+  else
+    i := high(arr)+1;
+  setlength(localarr,i);
+  for j:=0 to i-1 do
+    localarr[j]:=ord(arr[j]);
+  result:=JLString.create(localarr,0,i);
+end;
+
+
+{ lie, not used by the compiler }
+{$define FPC_HAS_UNICODECHARARRAY_TO_SHORTSTR}
+{$define FPC_HAS_UNICODECHARARRAY_TO_ANSISTR}
+{$define FPC_HAS_UNICODECHARARRAY_TO_UNICODESTR}
+
+Function real_widechararray_to_unicodestr(const arr: array of widechar; zerobased: boolean): Unicodestring;
+var
+  i  : SizeInt;
+  foundnull  : boolean;
+begin
+  if (zerobased) then
+    begin
+      foundnull:=false;
+      for i:=low(arr) to high(arr) do
+        if arr[i]=#0 then
+          begin
+            foundnull:=true;
+            break;
+          end;
+      if not foundnull then
+        i := high(arr)+1;
+    end
+  else
+    i := high(arr)+1;
+  result:=JLString.create(arr,0,i);
+end;
+
+{$define FPC_HAS_WIDECHARARRAY_TO_UNICODESTR}
+Function fpc_WideCharArray_To_UnicodeStr(const arr: array of widechar; zerobased: boolean = true): UnicodeString; compilerproc;
+begin
+  result:=real_widechararray_to_unicodestr(arr,zerobased);
+end;
+
+{ due to their names, the following procedures should be in wstrings.inc,
+  however, the compiler generates code using this functions on all platforms }
+{$define FPC_HAS_WIDECHARARRAY_TO_SHORTSTR}
+procedure fpc_WideCharArray_To_ShortStr(out res : shortstring;const arr: array of widechar; zerobased: boolean = true);[public,alias:'FPC_WIDECHARARRAY_TO_SHORTSTR']; compilerproc;
+begin
+  res:=real_widechararray_to_unicodestr(arr,zerobased);
+end;
+
+{$define FPC_HAS_WIDECHARARRAY_TO_ANSISTR}
+Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; zerobased: boolean = true): AnsiString; compilerproc;
+begin
+  result:=real_widechararray_to_unicodestr(arr,zerobased);
+end;
+
+{ lie, not used by this target }
+{$define FPC_HAS_WIDECHARARRAY_TO_WIDESTR}
+
+
+{$define FPC_HAS_UNICODESTR_TO_CHARARRAY}
+procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: UnicodeString); compilerproc;
+var
+  len: longint;
+  temp: array of jbyte;
+begin
+  len:=length(src);
+  { make sure we don't dereference src if it can be nil (JM) }
+  if len>0 then
+    begin
+      temp:=JLString(src).getBytes;
+      len:=length(temp);
+      if len>length(res) then
+        len:=length(res);
+      JLSystem.ArrayCopy(JLObject(temp),0,JLObject(@res),0,len);
+    end;
+  if len<=high(res) then
+    JUArrays.fill(TJByteArray(@res),len,high(res),0);
+end;
+
+
+function fpc_unicodestr_setchar(const s: UnicodeString; const index: longint; const ch: unicodechar): UnicodeString; compilerproc;
+var
+  sb: JLStringBuilder;
+begin
+  sb:=JLStringBuilder.create(s);
+  { string indexes are 1-based in Pascal, 0-based in Java }
+  sb.setCharAt(index-1,ch);
+  result:=sb.toString();
+end;
+
+
+{ lie, not used by the compiler }
+{$define FPC_HAS_UNICODESTR_TO_UNICODECHARARRAY}
+{$define FPC_HAS_ANSISTR_TO_UNICODECHARARRAY}
+{$define FPC_HAS_SHORTSTR_TO_UNICODECHARARRAY}
+
+{$define FPC_HAS_ANSISTR_TO_WIDECHARARRAY}
+procedure fpc_ansistr_to_widechararray(out res: array of widechar; const src: AnsiString); compilerproc;
+var
+  len: SizeInt;
+  temp: widestring;
+begin
+  len := length(src);
+  { make sure we don't dereference src if it can be nil (JM) }
+  if len > 0 then
+    temp:=src;
+  len := length(temp);
+  if len > high(res)+1 then
+    len := high(res)+1;
+
+  JLString(temp).getChars(0,len,res,0);
+  JUArrays.fill(res,len,high(res),#0);
+end;
+
+
+{$define FPC_HAS_SHORTSTR_TO_WIDECHARARRAY}
+procedure fpc_shortstr_to_widechararray(out res: array of widechar; const src: ShortString); compilerproc;
+var
+  len: longint;
+  temp : unicodestring;
+begin
+  len := length(src);
+  { temp is initialized with an empty string, so no need to convert src in case
+    it's also empty}
+  if len > 0 then
+    temp:=src;
+  len := length(temp);
+  if len > high(res)+1 then
+    len := high(res)+1;
+
+  JLString(temp).getChars(0,len,res,0);
+  JUArrays.fill(res,len,high(res),#0);
+end;
+
+
+{$define FPC_HAS_UNICODESTR_TO_WIDECHARARRAY}
+procedure fpc_unicodestr_to_widechararray(out res: array of widechar; const src: UnicodeString); compilerproc;
+var
+  i, len: SizeInt;
+begin
+  len := length(src);
+  if len > length(res) then
+    len := length(res);
+  JLString(src).getChars(0,len,res,0);
+end;
+
+
+{$define FPC_HAS_UNICODESTR_COMPARE}
+Function fpc_UnicodeStr_Compare(const S1,S2 : UnicodeString): SizeInt; compilerproc;
+{
+  Compares 2 UnicodeStrings;
+  The result is
+   <0 if S1<S2
+   0 if S1=S2
+   >0 if S1>S2
+}
+Var
+  MaxI,Temp : SizeInt;
+begin
+  if JLObject(S1)=JLObject(S2) then
+   begin
+     result:=0;
+     exit;
+   end;
+  result:=JLString(S1).compareTo(S2);
+end;
+
+
+{$define FPC_HAS_UNICODESTR_COMPARE_EQUAL}
+Function fpc_UnicodeStr_Compare_Equal(const S1,S2 : UnicodeString): SizeInt; compilerproc;
+{
+  Compares 2 UnicodeStrings for equality only;
+  The result is
+   0 if S1=S2
+   <>0 if S1<>S2
+}
+Var
+  MaxI : SizeInt;
+begin
+  result:=ord(not JLString(S1).equals(JLString(S2)));
+end;
+
+{ lie, not required for this target }
+{$define FPC_HAS_UNICODESTR_RANGECHECK}
+
+
+{$define FPC_HAS_UNICODESTR_SETLENGTH}
+function fpc_UnicodeStr_SetLength(const S : UnicodeString; l : SizeInt): UnicodeString; compilerproc;
+{
+  Sets The length of string S to L.
+  Makes sure S is unique, and contains enough room.
+  Returns new val
+}
+Var
+  movelen: SizeInt;
+  chars: array of widechar;
+  strlen: SizeInt;
+begin
+   if (l>0) then
+    begin
+      if JLObject(S)=nil then
+       begin
+         { Need a completely new string...}
+         result:=NewUnicodeString(l);
+       end
+      { no need to create a new string, since Java strings are immutable }
+      else
+        begin
+          strlen:=length(s);
+          if l=strlen then
+            result:=s
+          else if (l<strlen) then
+            result:=JLString(s).substring(0,l)
+          else
+            begin
+              setlength(chars,l);
+              JLString(s).getChars(0,strlen,chars,0);
+              result:=JLString.create(chars,0,l)
+            end;
+        end
+    end
+  else
+    begin
+      result:='';
+    end;
+end;
+
+{*****************************************************************************
+                     Public functions, In interface.
+*****************************************************************************}
+
+{$define FPC_HAS_STRING_TO_UNICODECHAR}
+function StringToUnicodeChar(const Src : AnsiString;Dest : PUnicodeChar;DestSize : SizeInt) : PUnicodeChar;
+  begin
+    result:=StringToWideChar(Src,Dest,DestSize);
+  end;
+
+
+{$define FPC_HAS_STRING_LEN_TO_WIDECHAR}
+function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
+  var
+    temp:widestring;
+  begin
+    temp:=src;
+     if Length(temp)<DestSize then
+       JLString(temp).getChars(0,length(temp),TJCharArray(Dest),0)
+     else
+       JLString(temp).getChars(0,DestSize-1,TJCharArray(Dest),0);
+     Dest[DestSize-1]:=#0;
+     result:=Dest;
+  end;
+
+
+{$define FPC_HAS_UNICODECHAR_LEN_TO_STRING}
+function UnicodeCharLenToString(S : PUnicodeChar;Len : SizeInt) : AnsiString;
+  begin
+     result:=JLString.Create(TJCharArray(S),0,len);
+  end;
+
+
+{$define FPC_HAS_WIDECHAR_LEN_TO_STRING}
+function WideCharLenToString(S : PWideChar;Len : SizeInt) : AnsiString;
+  begin
+     result:=JLString.Create(TJCharArray(S),0,len);
+  end;
+
+
+{$define FPC_HAS_UNICODESTR_UNIQUE}
+Function fpc_unicodestr_Unique(var S : JLObject): JLObject; compilerproc;
+begin
+  result:=s;
+end;
+
+{ the publicly accessible uniquestring function is declared as
+  "external name 'FPC_UNICODESTR_UNIQUE'", which is normally an alias for
+  the fpc_unicodestr_Unique compiler proc; since one is a function and the
+  other a procedure that sort of hackery doesn't work for the JVM -> create
+  a separate procedure for that (since Java strings are immutable, they are
+  always unique though) }
+procedure FPC_UNICODESTR_UNIQUE(var S : UnicodeString);
+begin
+  { do nothing }
+end;
+
+
+{$define FPC_HAS_UNICODESTR_COPY}
+Function Fpc_UnicodeStr_Copy (Const S : UnicodeString; Index,Size : SizeInt) : UnicodeString;compilerproc;
+begin
+  dec(index);
+  if Index < 0 then
+    Index := 0;
+  { Check Size. Accounts for Zero-length S, the double check is needed because
+    Size can be maxint and will get <0 when adding index }
+  if (Size>Length(S)) or
+     (Index+Size>Length(S)) then
+   Size:=Length(S)-Index;
+  If Size>0 then
+    result:=JLString(s).subString(Index,Size)
+  else
+    result:='';
+end;
+
+
+{$define FPC_HAS_POS_UNICODESTR_UNICODESTR}
+Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString) : SizeInt;
+begin
+  Pos:=0;
+  if Length(SubStr)>0 then
+    Pos:=JLString(Source).indexOf(SubStr)+1;
+end;
+
+
+{ Faster version for a unicodechar alone }
+{$define FPC_HAS_POS_UNICODECHAR_UNICODESTR}
+Function Pos (c : UnicodeChar; Const s : UnicodeString) : SizeInt;
+begin
+  Pos:=0;
+  if length(S)>0 then
+    Pos:=JLString(s).indexOf(ord(c))+1;
+end;
+
+
+{ Faster version for a char alone. Must be implemented because   }
+{ pos(c: char; const s: shortstring) also exists, so otherwise   }
+{ using pos(char,pchar) will always call the shortstring version }
+{ (exact match for first argument), also with $h+ (JM)           }
+{$define FPC_HAS_POS_CHAR_UNICODESTR}
+Function Pos (c : AnsiChar; Const s : UnicodeString) : SizeInt;
+var
+  i: SizeInt;
+  wc : unicodechar;
+begin
+  wc:=c;
+  result:=Pos(wc,s);
+end;
+
+
+{$define FPC_HAS_DELETE_UNICODESTR}
+Procedure Delete (Var S : UnicodeString; Index,Size: SizeInt);
+Var
+  LS : SizeInt;
+  sb: JLStringBuilder;
+begin
+  LS:=Length(S);
+  if (Index>LS) or (Index<=0) or (Size<=0) then
+    exit;
+
+  { (Size+Index) will overflow if Size=MaxInt. }
+  if Size>LS-Index then
+    Size:=LS-Index+1;
+  if Size<=LS-Index then
+    begin
+      Dec(Index);
+      sb:=JLStringBuilder.Create(s);
+      sb.delete(index,size);
+      s:=sb.toString;
+    end
+  else
+    s:=JLString(s).substring(0,index-1);
+end;
+
+
+{$define FPC_HAS_INSERT_UNICODESTR}
+Procedure Insert (Const Source : UnicodeString; Var S : UnicodeString; Index : SizeInt);
+var
+  Temp : UnicodeString;
+  LS : SizeInt;
+  sb : JLStringBuilder;
+begin
+  If Length(Source)=0 then
+   exit;
+  if index <= 0 then
+   index := 1;
+  Ls:=Length(S);
+  if index > LS then
+   index := LS+1;
+  Dec(Index);
+  sb:=JLStringBuilder.Create(S);
+  sb.insert(Index,Source);
+  S:=sb.toString;
+end;
+
+
+{$define FPC_HAS_UPCASE_UNICODECHAR}
+Function  UpCase(c:UnicodeChar):UnicodeChar;
+begin
+  result:=JLCharacter.toUpperCase(c);
+end;
+
+
+{$define FPC_HAS_UPCASE_UNICODESTR}
+function UpCase(const s : UnicodeString) : UnicodeString;
+begin
+  result:=JLString(s).toUpperCase;
+end;
+
+
+{$define FPC_HAS_LOWERCASE_UNICODECHAR}
+Function  LowerCase(c:UnicodeChar):UnicodeChar;
+begin
+  result:=JLCharacter.toLowerCase(c);
+end;
+
+
+{$define FPC_HAS_LOWERCASE_UNICODESTR}
+function LowerCase(const s : UnicodeString) : UnicodeString;
+begin
+  result:=JLString(s).toLowerCase;
+end;
+
+
+{$define FPC_HAS_SETSTRING_UNICODESTR_PUNICODECHAR}
+Procedure SetString (Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt);
+begin
+  if Len>0 then
+    s:=JLString.Create(TJCharArray(Buf),0,Len)
+  else
+    s:='';
+end;
+
+
+{$define FPC_HAS_SETSTRING_UNICODESTR_PCHAR}
+Procedure SetString (Out S : UnicodeString; Buf : PChar; Len : SizeInt);
+begin
+  if Len>0 then
+    s:=JLString.Create(TJByteArray(Buf),0,Len)
+  else
+    s:='';
+end;
+
+
+{$define FPC_HAS_UNICODE_TO_UTF8}
+function UnicodeToUtf8(Dest: PChar; Source: PUnicodeChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
+  begin
+    if assigned(Source) then
+      Result:=UnicodeToUtf8(Dest,MaxBytes,Source,length(Source))
+    else
+      Result:=0;
+  end;
+
+
+{$define FPC_HAS_UTF8ENCODE_UNICODESTRING}
+function UTF8Encode(const s : UnicodeString) : UTF8String;
+  var
+    i : SizeInt;
+    hs : UTF8String;
+    chars: array of widechar;
+  begin
+    result:='';
+    if s='' then
+      exit;
+    SetLength(hs,length(s)*3);
+    chars:=JLString(s).toCharArray;
+    i:=UnicodeToUtf8(pchar(hs),length(hs)+1,pwidechar(chars),length(s));
+    if i>0 then
+      begin
+        SetLength(hs,i-1);
+        result:=hs;
+      end;
+  end;
+
+
+{$define FPC_HAS_UTF8DECODE_UNICODESTRING}
+function UTF8Decode(const s : UTF8String): UnicodeString;
+  var
+    i : SizeInt;
+    hs : UnicodeString;
+    chars: array of widechar;
+  begin
+    result:='';
+    if s='' then
+      exit;
+    SetLength(chars,length(s));
+    i:=Utf8ToUnicode(pwidechar(chars),length(hs)+1,pchar(s),length(s));
+    if i>0 then
+      begin
+        result:=JLString.Create(chars,0,i);
+      end;
+  end;
+
+
+{$define FPC_HAS_UCS4STRING_TO_UNICODESTR}
+
+{ concatenates an utf-32 char to a unicodestring. S *must* be unique when entering. }
+procedure ConcatUTF32ToUnicodeStr(const nc: UCS4Char; var S: JLStringBuilder; var index: SizeInt);
+begin
+  { if nc > $ffff, we need two places }
+  if (index+ord(nc > $ffff)>s.length) then
+    if (s.length < 10*256) then
+      s.setLength(s.length+10)
+    else
+      s.setlength(s.length+s.length shr 8);
+  if (nc<$ffff) then
+    begin
+      s.setCharAt(index-1,unicodechar(nc));
+      inc(index);
+    end
+  else if (dword(nc)<=$10ffff) then
+    begin
+      s.setCharAt(index-1,unicodechar((nc - $10000) shr 10 + $d800));
+      s.setCharAt(index,unicodechar((nc - $10000) and $3ff + $dc00));
+      inc(index,2);
+    end
+  else
+    { invalid code point }
+    begin
+      s.setCharAt(index-1,'?');
+      inc(index);
+    end;
+end;
+
+
+function UCS4StringToUnicodeString(const s : UCS4String) : UnicodeString;
+  var
+    i        : SizeInt;
+    resindex : SizeInt;
+    tmpres: JLStringBuilder;
+  begin
+    { skip terminating #0 }
+    tmpres:=JLStringBuilder.Create(length(s)-1);
+    resindex:=1;
+    for i:=0 to high(s)-1 do
+      ConcatUTF32ToUnicodeStr(s[i],tmpres,resindex);
+    { adjust result length (may be too big due to growing }
+    { for surrogate pairs)                                }
+    tmpres.setLength(resindex-1);
+    result:=tmpres.toString;
+  end;
+
+
+
+{$define FPC_HAS_UCS4STRING_TO_WIDESTR}
+function UCS4StringToWideString(const s : UCS4String) : WideString;
+  begin
+    result:=UCS4StringToUnicodeString(s);
+  end;
+
+
+{ *************************************************************************** }
+{ ************************* Collator threadvar ****************************** }
+{ *************************************************************************** }
+
+function TCollatorThreadVar.InitialValue: JLObject;
+  begin
+    { get a copy, since we modify the collator (e.g. setting the strength) }
+    result:=JTCollator.getInstance.clone
+  end;
+
+
+{ *************************************************************************** }
+{ ************************** Decoder threadvar ****************************** }
+{ *************************************************************************** }
+
+function TCharsetDecoderThreadvar.InitialValue: JLObject;
+  var
+    decoder: JNCCharsetDecoder;
+  begin
+    decoder:=JNCCharset.defaultCharset.newDecoder;
+    decoder.replaceWith('?');
+    result:=decoder;
+  end;
+
+
+{ *************************************************************************** }
+{ ************************** Encoder threadvar ****************************** }
+{ *************************************************************************** }
+
+function TCharsetEncoderThreadvar.InitialValue: JLObject;
+  var
+    encoder: JNCCharsetEncoder;
+    replacement: array[0..0] of jbyte;
+  begin
+    encoder:=JNCCharset.defaultCharset.newEncoder;
+    replacement[0]:=ord('?');
+    encoder.replaceWith(replacement);
+    result:=encoder;
+  end;
+
+
+{ *************************************************************************** }
+{ ************************ TUnicodeStringManager **************************** }
+{ *************************************************************************** }
+
+class constructor TUnicodeStringManager.ClassCreate;
+  begin
+    collator:=TCollatorThreadVar.Create;
+    decoder:=TCharsetDecoderThreadVar.Create;
+    encoder:=TCharsetEncoderThreadVar.Create;
+  end;
+
+
+procedure TUnicodeStringManager.Wide2AnsiMoveProc(source:pwidechar;var dest:ansistring;len:SizeInt);
+  begin
+    DefaultUnicode2AnsiMove(source,dest,len);
+  end;
+
+
+procedure TUnicodeStringManager.Ansi2WideMoveProc(source:pchar;var dest:widestring;len:SizeInt);
+  begin
+    DefaultAnsi2UnicodeMove(source,dest,len);
+  end;
+
+
+function TUnicodeStringManager.UpperWideStringProc(const S: WideString): WideString;
+  begin
+    result:=upcase(s);
+  end;
+
+
+function TUnicodeStringManager.LowerWideStringProc(const S: WideString): WideString;
+  begin
+    result:=lowercase(s);
+  end;
+
+
+function TUnicodeStringManager.CompareWideStringProc(const s1, s2 : WideString) : PtrInt;
+  var
+    localcollator: JTCollator;
+  begin
+    localcollator:=JTCollator(collator.get);
+    localcollator.setStrength(JTCollator.IDENTICAL);
+    result:=localcollator.compare(s1,s2);
+  end;
+
+
+function TUnicodeStringManager.CompareTextWideStringProc(const s1, s2 : WideString): PtrInt;
+  var
+    localcollator: JTCollator;
+  begin
+    localcollator:=JTCollator(collator.get);
+    localcollator.setStrength(JTCollator.TERTIARY);
+    result:=localcollator.compare(s1,s2);
+  end;
+
+
+function TUnicodeStringManager.CharLengthPCharProc(const Str: PChar; Index: PtrInt): PtrInt;
+  var
+    localdecoder: JNCCharsetDecoder;
+  begin
+    localdecoder:=JNCCharsetDecoder(decoder.get);
+    localdecoder.reset;
+    localdecoder.onMalformedInput(JNCCodingErrorAction.fREPLACE);
+    localdecoder.onUnmappableCharacter(JNCCodingErrorAction.fREPLACE);
+    result:=localdecoder.decode(JNByteBuffer.wrap(TJByteArray(Str),Index,length(Str)-Index)).length;
+  end;
+
+
+function TUnicodeStringManager.CodePointLengthProc(const Str: PChar; Index, MaxLookAhead: PtrInt): Ptrint;
+  var
+    localdecoder: JNCCharsetDecoder;
+    inbuf: JNByteBuffer;
+    outbuf: JNCharBuffer;
+    coderres: JNCCoderResult;
+    limit, maxlimit: longint;
+  begin
+    localdecoder:=JNCCharsetDecoder(decoder.get);
+    localdecoder.onMalformedInput(JNCCodingErrorAction.fREPORT);
+    localdecoder.onUnmappableCharacter(JNCCodingErrorAction.fREPORT);
+    localdecoder.reset;
+    limit:=0;
+    maxlimit:=min(length(Str)-Index,MaxLookAhead);
+    { end of pchar? }
+    if maxlimit=0 then
+      begin
+        result:=0;
+        exit;
+      end;
+    inbuf:=JNByteBuffer.wrap(TJByteArray(Str),Index,Index+maxlimit);
+    { we will get at most 2 output characters (when decoding from UTF-32 to
+      UTF-16) }
+    outbuf:=JNCharBuffer.allocate(2);
+    { keep trying to decode until we managed to decode one character or
+      reached the limit }
+    repeat
+      inc(limit);
+      inbuf.limit(limit);
+      coderres:=localdecoder.decode(inbuf,outbuf,true);
+    until not coderres.isError or
+          (limit=MaxLookAhead);
+    if not coderres.isError then
+      result:=inbuf.limit
+    else
+      result:=-1;
+  end;
+
+
+function TUnicodeStringManager.UpperAnsiStringProc(const s : ansistring) : ansistring;
+  begin
+    result:=UpperWideStringProc(s);
+  end;
+
+
+function TUnicodeStringManager.LowerAnsiStringProc(const s : ansistring) : ansistring;
+  begin
+    result:=LowerWideStringProc(s);
+  end;
+
+
+function TUnicodeStringManager.CompareStrAnsiStringProc(const S1, S2: ansistring): PtrInt;
+  begin
+    result:=CompareUnicodeStringProc(S1,S2);
+  end;
+
+
+function TUnicodeStringManager.CompareTextAnsiStringProc(const S1, S2: ansistring): PtrInt;
+  begin
+    result:=CompareTextUnicodeStringProc(S1,S2);
+  end;
+
+
+function TUnicodeStringManager.StrCompAnsiStringProc(S1, S2: PChar): PtrInt;
+  var
+    str1,str2: unicodestring;
+  begin
+    str1:=JLString.Create(TJCharArray(S1),0,length(S1));
+    str2:=JLString.Create(TJCharArray(S2),0,length(S2));
+    result:=CompareUnicodeStringProc(str1,str2);
+  end;
+
+
+function TUnicodeStringManager.StrICompAnsiStringProc(S1, S2: PChar): PtrInt;
+  var
+    str1,str2: unicodestring;
+  begin
+    str1:=JLString.Create(TJCharArray(S1),0,length(S1));
+    str2:=JLString.Create(TJCharArray(S2),0,length(S2));
+    result:=CompareTextUnicodeStringProc(str1,str2);
+  end;
+
+
+function TUnicodeStringManager.StrLCompAnsiStringProc(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+  var
+    str1,str2: unicodestring;
+  begin
+    str1:=JLString.Create(TJCharArray(S1),0,min(length(S1),MaxLen));
+    str2:=JLString.Create(TJCharArray(S2),0,min(length(S2),MaxLen));
+    result:=CompareUnicodeStringProc(str1,str2);
+  end;
+
+
+function TUnicodeStringManager.StrLICompAnsiStringProc(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+  var
+    str1,str2: unicodestring;
+  begin
+    str1:=JLString.Create(TJCharArray(S1),0,min(length(S1),MaxLen));
+    str2:=JLString.Create(TJCharArray(S2),0,min(length(S2),MaxLen));
+    result:=CompareTextUnicodeStringProc(str1,str2);
+  end;
+
+
+function TUnicodeStringManager.StrLowerAnsiStringProc(Str: PChar): PChar;
+  var
+    ustr: unicodestring;
+  begin
+    ustr:=JLString.Create(TJCharArray(Str),0,length(Str));
+    result:=PChar(AnsiStringClass(ansistring(LowerWideStringProc(ustr))).fdata);
+  end;
+
+
+function TUnicodeStringManager.StrUpperAnsiStringProc(Str: PChar): PChar;
+  var
+    ustr: unicodestring;
+  begin
+    ustr:=JLString.Create(TJCharArray(Str),0,length(Str));
+    result:=PChar(AnsiStringClass(ansistring(UpperWideStringProc(ustr))).fdata);
+  end;
+
+
+procedure TUnicodeStringManager.Unicode2AnsiMoveProc(source:punicodechar;var dest:ansistring;len:SizeInt);
+  begin
+    DefaultUnicode2AnsiMove(source,dest,len);
+  end;
+
+
+procedure TUnicodeStringManager.Ansi2UnicodeMoveProc(source:pchar;var dest:unicodestring;len:SizeInt);
+  begin
+    DefaultAnsi2UnicodeMove(source,dest,len);
+  end;
+
+
+function TUnicodeStringManager.UpperUnicodeStringProc(const S: UnicodeString): UnicodeString;
+  begin
+    result:=UpperWideStringProc(S);
+  end;
+
+
+function TUnicodeStringManager.LowerUnicodeStringProc(const S: UnicodeString): UnicodeString;
+  begin
+    result:=LowerWideStringProc(S);
+  end;
+
+
+function TUnicodeStringManager.CompareUnicodeStringProc(const s1, s2 : UnicodeString) : PtrInt;
+  begin
+    result:=CompareWideStringProc(s1,s2);
+  end;
+
+
+function TUnicodeStringManager.CompareTextUnicodeStringProc(const s1, s2 : UnicodeString): PtrInt;
+  begin
+    result:=CompareTextWideStringProc(s1,s2);
+  end;
+
+
+
+procedure initunicodestringmanager;
+  begin
+    widestringmanager:=TUnicodeStringManager.Create;
+  end;
+

+ 5 - 1
rtl/java/system.pp

@@ -86,13 +86,16 @@ const
 {$i jrech.inc}
 {$i jseth.inc}
 {$i jpvarh.inc}
+
 {$i jsystemh_types.inc}
+
 {$i jtvarh.inc}
 {$i jsstringh.inc}
 {$i jdynarrh.inc}
 {$i astringh.inc}
+{$i justringh.inc}
+
 {$i jsystemh.inc}
-{$i compproc.inc}
 
 
 {*****************************************************************************}
@@ -109,6 +112,7 @@ function min(a,b : longint) : longint;
 
 {$i jtvar.inc}
 {$i jsstrings.inc}
+{$i justrings.inc}
 {$i jrec.inc}
 {$i jset.inc}
 {$i jpvar.inc}

+ 0 - 81
rtl/java/ustringh.inc

@@ -1,81 +0,0 @@
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2005 by Florian Klaempfl,
-    member of the Free Pascal development team.
-
-    This file implements support routines for UnicodeStrings with FPC
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-
-Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString) : SizeInt;
-Function Pos (c : Char; Const s : UnicodeString) : SizeInt;
-//Function Pos (c : UnicodeChar; Const s : UnicodeString) : SizeInt;
-//Function Pos (c : AnsiString; Const s : UnicodeString) : SizeInt;
-//Function Pos (c : UnicodeString; Const s : AnsiString) : SizeInt;
-//Function Pos (c : ShortString; Const s : UnicodeString) : SizeInt;
-
-Function UpCase(const s : UnicodeString) : UnicodeString;
-Function UpCase(c:UnicodeChar):UnicodeChar;
-
-//Procedure Insert (Const Source : UnicodeString; Var S : UnicodeString; Index : SizeInt);
-//Procedure Delete (Var S : UnicodeString; Index,Size: SizeInt);
-//Procedure SetString (Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt);
-//Procedure SetString (Out S : UnicodeString; Buf : PChar; Len : SizeInt);
-//
-//function WideCharToString(S : PWideChar) : AnsiString;
-//function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
-//function WideCharLenToString(S : PWideChar;Len : SizeInt) : AnsiString;
-//procedure WideCharLenToStrVar(Src : PWideChar;Len : SizeInt;out Dest : AnsiString);
-//procedure WideCharToStrVar(S : PWideChar;out Dest : AnsiString);
-//
-//function UnicodeCharToString(S : PUnicodeChar) : AnsiString;
-//function StringToUnicodeChar(const Src : AnsiString;Dest : PUnicodeChar;DestSize : SizeInt) : PUnicodeChar;
-//function UnicodeCharLenToString(S : PUnicodeChar;Len : SizeInt) : AnsiString;
-//procedure UnicodeCharLenToStrVar(Src : PUnicodeChar;Len : SizeInt;out Dest : AnsiString);
-//procedure UnicodeCharToStrVar(S : PUnicodeChar;out Dest : AnsiString);
-//
-//procedure DefaultUnicode2AnsiMove(source:punicodechar;var dest:ansistring;len:SizeInt);
-//procedure DefaultAnsi2UnicodeMove(source:pchar;var dest:unicodestring;len:SizeInt);
-
-Type
-  { hooks for internationalization
-    please add new procedures at the end, it makes it easier to detect new procedures }
-  TUnicodeStringManager = class(JLObject)
-    collator: JTCollator;
-    constructor create;
-  end;
-
-var
-  widestringmanager : TUnicodeStringManager;
-
-//function UnicodeToUtf8(Dest: PChar; Source: PUnicodeChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-//function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PUnicodeChar; SourceChars: SizeUInt): SizeUInt;
-//function Utf8ToUnicode(Dest: PUnicodeChar; Source: PChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-//function Utf8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt): SizeUInt;
-//function UTF8Encode(const s : Ansistring) : UTF8String; inline;
-//function UTF8Encode(const s : UnicodeString) : UTF8String;
-//function UTF8Decode(const s : UTF8String): UnicodeString;
-//function AnsiToUtf8(const s : ansistring): UTF8String;{$ifdef SYSTEMINLINE}inline;{$endif}
-//function Utf8ToAnsi(const s : UTF8String) : ansistring;{$ifdef SYSTEMINLINE}inline;{$endif}
-//function UnicodeStringToUCS4String(const s : UnicodeString) : UCS4String;
-//function UCS4StringToUnicodeString(const s : UCS4String) : UnicodeString;
-//function WideStringToUCS4String(const s : WideString) : UCS4String;
-//function UCS4StringToWideString(const s : UCS4String) : WideString;
-
-//Procedure GetWideStringManager (Var Manager : TUnicodeStringManager);
-//Procedure SetWideStringManager (Const New : TUnicodeStringManager);
-//Procedure SetWideStringManager (Const New : TUnicodeStringManager; Var Old: TUnicodeStringManager);
-
-//Procedure GetUnicodeStringManager (Var Manager : TUnicodeStringManager);
-//Procedure SetUnicodeStringManager (Const New : TUnicodeStringManager);
-//Procedure SetUnicodeStringManager (Const New : TUnicodeStringManager; Var Old: TUnicodeStringManager);
-
-

+ 0 - 1701
rtl/java/ustrings.inc

@@ -1,1701 +0,0 @@
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2005 by Florian Klaempfl,
-    Copyright (c) 2011 by Jonas Maebe,
-    members of the Free Pascal development team.
-
-    This file implements support routines for UTF-8 strings with FPC
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-{$i wustrings.inc}
-
-{
-  This file contains the implementation of the UnicodeString type,
-  which on the Java platforms is an alias for java.lang.String
-}
-
-
-Function NewUnicodeString(Len : SizeInt) : JLString;
-{
-  Allocate a new UnicodeString on the heap.
-  initialize it to zero length and reference count 1.
-}
-var
-  data: array of jchar;
-begin
-  setlength(data,len);
-  result:=JLString.create(data);
-end;
-
-
-procedure fpc_UnicodeStr_To_ShortStr (out res: ShortString;const S2 : UnicodeString); [Public, alias: 'FPC_UNICODESTR_TO_SHORTSTR'];compilerproc;
-{
-  Converts a UnicodeString to a ShortString;
-}
-Var
-  Size : SizeInt;
-  temp : ansistring;
-begin
-  res:='';
-  Size:=Length(S2);
-  if Size>0 then
-    begin
-      temp:=s2;
-      res:=temp;
-    end;
-end;
-
-
-Function fpc_ShortStr_To_UnicodeStr (Const S2 : ShortString): UnicodeString;compilerproc;
-{
-  Converts a ShortString to a UnicodeString;
-}
-Var
-  Size : SizeInt;
-begin
-  result:='';
-  Size:=Length(S2);
-  if Size>0 then
-    result:=unicodestring(JLString.Create(TJByteArray(ShortstringClass(@S2).fdata),0,Size));
-end;
-
-Function fpc_UnicodeStr_To_AnsiStr (const S2 : UnicodeString): AnsiString; compilerproc;
-{
-  Converts a UnicodeString to an AnsiString
-}
-Var
-  Size : SizeInt;
-begin
-  result:=Ansistring(AnsistringClass.Create(s2));
-end;
-
-
-Function fpc_AnsiStr_To_UnicodeStr (Const S2 : AnsiString): UnicodeString; compilerproc;
-{
-  Converts an AnsiString to a UnicodeString;
-}
-Var
-  Size : SizeInt;
-begin
-  if length(s2)=0 then
-    result:=''
-  else
-    result:=AnsistringClass(S2).toString;
-end;
-
-Function fpc_UnicodeStr_To_WideStr (const S2 : UnicodeString): WideString; compilerproc;
-  begin
-    result:=s2;
-  end;
-
-
-Function fpc_WideStr_To_UnicodeStr (Const S2 : WideString): UnicodeString; compilerproc;
-  begin
-    result:=s2;
-  end;
-
-function fpc_UnicodeStr_Concat (const S1,S2 : UnicodeString): UnicodeString; compilerproc;
-Var
-  sb: JLStringBuilder;
-begin
-  { only assign if s1 or s2 is empty }
-  if (length(S1)=0) then
-    begin
-      result:=s2;
-      exit;
-    end;
-  if (length(S2)=0) then
-    begin
-      result:=s1;
-      exit;
-    end;
-  sb:=JLStringBuilder.create(S1);
-  sb.append(s2);
-  result:=sb.toString;
-end;
-
-
-function fpc_UnicodeStr_Concat_multi (const sarr:array of Unicodestring): unicodestring; compilerproc;
-Var
-  i  : Longint;
-  Size,NewSize : SizeInt;
-  sb: JLStringBuilder;
-begin
-  { First calculate size of the result so we can allocate a StringBuilder of
-    the right size }
-  NewSize:=0;
-  for i:=low(sarr) to high(sarr) do
-    inc(Newsize,length(sarr[i]));
-  sb:=JLStringBuilder.create(NewSize);
-  for i:=low(sarr) to high(sarr) do
-    begin
-      if length(sarr[i])>0 then
-        sb.append(sarr[i]);
-    end;
-  result:=sb.toString;
-end;
-
-
-Function fpc_Char_To_UChar(const c : AnsiChar): UnicodeChar; compilerproc;
-var
-  str: JLString;
-  arr: array of jbyte;
-begin
-  setlength(arr,1);
-  arr[0]:=ord(c);
-  result:=JLString.create(arr,0,1).charAt(0);
-end;
-
-
-
-Function fpc_Char_To_UnicodeStr(const c : AnsiChar): UnicodeString; compilerproc;
-{
-  Converts a AnsiChar to a UnicodeString;
-}
-var
-  str: JLString;
-  arr: array of jbyte;
-begin
-  setlength(arr,1);
-  arr[0]:=ord(c);
-  result:=JLString.create(arr,0,1);
-end;
-
-
-Function fpc_UChar_To_Char(const c : UnicodeChar): AnsiChar; compilerproc;
-{
-  Converts a UnicodeChar to a AnsiChar;
-}
-var
-  arrb: array of jbyte;
-  arrw: array of jchar;
-  str: JLString;
-begin
-  setlength(arrw,1);
-  arrw[0]:=c;
-  str:=JLString.create(arrw);
-  arrb:=str.getbytes();
-  result:=chr(arrb[0]);
-end;
-
-
-Function fpc_WChar_To_UnicodeStr(const c : WideChar): UnicodeString; compilerproc;
-{
-  Converts a WideChar to a UnicodeString;
-}
-var
-  arrw: array of jchar;
-begin
-  setlength(arrw,1);
-  arrw[0]:=c;
-  result:=JLString.create(arrw);
-end;
-
-
-Function fpc_Char_To_WChar(const c : AnsiChar): WideChar; compilerproc;
-{
-  Converts a AnsiChar to a WideChar;
-}
-var
-  str: JLString;
-  arr: array of jbyte;
-begin
-  setlength(arr,1);
-  arr[0]:=ord(c);
-  result:=JLString.create(arr,0,1).charAt(0);
-end;
-
-
-Function fpc_WChar_To_Char(const c : WideChar): AnsiChar; compilerproc;
-{
-  Converts a WideChar to a AnsiChar;
-}
-var
-  arrb: array of jbyte;
-  arrw: array of jchar;
-begin
-  setlength(arrw,1);
-  arrw[0]:=c;
-  arrb:=JLString.create(arrw).getbytes();
-  result:=chr(arrb[0]);
-end;
-
-procedure fpc_WChar_To_ShortStr(out res : shortstring;const c : WideChar) compilerproc;
-{
-  Converts a WideChar to a ShortString;
-}
-var
-  u: unicodestring;
-begin
-  u:=c;
-  res:=u;
-end;
-
-Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
-{
-  Converts a UnicodeChar to a UnicodeString;
-}
-var
-  arr: array[0..0] of UnicodeChar;
-begin
-  arr[0]:=c;
-  result:=JLString.create(arr);
-end;
-
-
-Function fpc_UChar_To_AnsiStr(const c : UnicodeChar): AnsiString; compilerproc;
-{
-  Converts a UnicodeChar to a AnsiString;
-}
-var
-  u: unicodestring;
-begin
-  u:=c;
-  result:=u;
-end;
-
-
-Function fpc_PChar_To_UnicodeStr(const p : pchar): UnicodeString; compilerproc;
-var
-  i, len: longint;
-  arr: TAnsiCharArray;
-begin
-  arr:=TAnsiCharArray(p);
-  i:=0;
-  while arr[i]<>#0 do
-    inc(i);
-  if i<>0 then
-    result:=JLString.create(TJByteArray(arr),0,i)
-  else
-    result:=''
-end;
-
-
-Function fpc_CharArray_To_UnicodeStr(const arr: array of ansichar; zerobased: boolean = true): UnicodeString; compilerproc;
-var
-  i,j  : SizeInt;
-  localarr: array of jbyte;
-  foundnull: boolean;
-begin
-  if (zerobased) then
-    begin
-      if (arr[0]=#0) Then
-      begin
-        fpc_chararray_to_unicodestr := '';
-        exit;
-      end;
-      foundnull:=false;
-      for i:=low(arr) to high(arr) do
-        if arr[i]=#0 then
-          begin
-            foundnull:=true;
-            break;
-          end;
-      if not foundnull then
-        i := high(arr)+1;
-    end
-  else
-    i := high(arr)+1;
-  setlength(localarr,i);
-  for j:=0 to i-1 do
-    localarr[j]:=ord(arr[j]);
-  result:=JLString.create(localarr,0,i);
-end;
-
-(*
-function fpc_UnicodeCharArray_To_ShortStr(const arr: array of unicodechar; zerobased: boolean = true): shortstring;[public,alias:'FPC_UNICODECHARARRAY_TO_SHORTSTR']; compilerproc;
-var
-  l: longint;
- index: longint;
- len: byte;
- temp: ansistring;
- foundnull: boolean;
-begin
-  l := high(arr)+1;
-  if l>=256 then
-    l:=255
-  else if l<0 then
-    l:=0;
-  if zerobased then
-    begin
-      foundnull:=false;
-      for index:=low(arr) to l-1 do
-        if arr[index]=#0 then
-          begin
-            foundnull:=true;
-            break;
-          end;
-      if not foundnull then
-        len := l
-      else
-        len := index;
-    end
-  else
-    len := l;
-  result:=JLString.create(arr,0,l);
-end;
-
-
-Function fpc_UnicodeCharArray_To_AnsiStr(const arr: array of unicodechar; zerobased: boolean = true): AnsiString; compilerproc;
-var
-  i  : SizeInt;
-begin
-  if (zerobased) then
-    begin
-      i:=IndexWord(arr,high(arr)+1,0);
-      if i = -1 then
-        i := high(arr)+1;
-    end
-  else
-    i := high(arr)+1;
-  SetLength(fpc_UnicodeCharArray_To_AnsiStr,i);
-  widestringmanager.Unicode2AnsiMoveProc (punicodechar(@arr),fpc_UnicodeCharArray_To_AnsiStr,i);
-end;
-*)
-
-Function fpc_UnicodeCharArray_To_UnicodeStr(const arr: array of unicodechar; zerobased: boolean = true): UnicodeString; compilerproc;
-var
-  i  : SizeInt;
-  foundnull  : boolean;
-begin
-  if (zerobased) then
-    begin
-      foundnull:=false;
-      for i:=low(arr) to high(arr) do
-        if arr[i]=#0 then
-          begin
-            foundnull:=true;
-            break;
-          end;
-      if not foundnull then
-        i := high(arr)+1;
-    end
-  else
-    i := high(arr)+1;
-  result:=JLString.create(arr,0,i);
-end;
-
-Function real_widechararray_to_unicodestr(const arr: array of widechar; zerobased: boolean): Unicodestring;
-var
-  i  : SizeInt;
-  foundnull  : boolean;
-begin
-  if (zerobased) then
-    begin
-      foundnull:=false;
-      for i:=low(arr) to high(arr) do
-        if arr[i]=#0 then
-          begin
-            foundnull:=true;
-            break;
-          end;
-      if not foundnull then
-        i := high(arr)+1;
-    end
-  else
-    i := high(arr)+1;
-  result:=JLString.create(arr,0,i);
-end;
-
-Function fpc_WideCharArray_To_UnicodeStr(const arr: array of widechar; zerobased: boolean = true): UnicodeString; compilerproc;
-begin
-  result:=real_widechararray_to_unicodestr(arr,zerobased);
-end;
-
-{ due to their names, the following procedures should be in wstrings.inc,
-  however, the compiler generates code using this functions on all platforms }
-procedure fpc_WideCharArray_To_ShortStr(out res : shortstring;const arr: array of widechar; zerobased: boolean = true);[public,alias:'FPC_WIDECHARARRAY_TO_SHORTSTR']; compilerproc;
-begin
-  res:=real_widechararray_to_unicodestr(arr,zerobased);
-end;
-
-Function fpc_WideCharArray_To_AnsiStr(const arr: array of widechar; zerobased: boolean = true): AnsiString; compilerproc;
-begin
-  result:=real_widechararray_to_unicodestr(arr,zerobased);
-end;
-
-procedure fpc_unicodestr_to_chararray(out res: array of AnsiChar; const src: UnicodeString); compilerproc;
-var
-  len: longint;
-  temp: array of jbyte;
-begin
-  len:=length(src);
-  { make sure we don't dereference src if it can be nil (JM) }
-  if len>0 then
-    begin
-      temp:=JLString(src).getBytes;
-      len:=length(temp);
-      if len>length(res) then
-        len:=length(res);
-      JLSystem.ArrayCopy(JLObject(temp),0,JLObject(@res),0,len);
-    end;
-  if len<=high(res) then
-    JUArrays.fill(TJByteArray(@res),len,high(res),0);
-end;
-
-
-procedure fpc_unicodestr_to_unicodechararray(out res: array of unicodechar; const src: UnicodeString); compilerproc;
-var
-  len: SizeInt;
-begin
-  len := length(src);
-  { make sure we don't dereference src if it can be nil (JM) }
-  if len > 0 then
-    begin
-      if len > high(res)+1 then
-        len := high(res)+1;
-      JLString(src).getChars(0,len,res,0);
-    end;
-end;
-
-function fpc_unicodestr_setchar(const s: UnicodeString; const index: longint; const ch: unicodechar): UnicodeString; compilerproc;
-var
-  sb: JLStringBuilder;
-begin
-  sb:=JLStringBuilder.create(s);
-  { string indexes are 1-based in Pascal, 0-based in Java }
-  sb.setCharAt(index-1,ch);
-  result:=sb.toString();
-end;
-
-
-procedure fpc_ansistr_to_unicodechararray(out res: array of unicodechar; const src: AnsiString); compilerproc;
-var
-  len: SizeInt;
-  temp: unicodestring;
-begin
-  len := length(src);
-  { make sure we don't dereference src if it can be nil (JM) }
-  if len > 0 then
-    temp:=src;
-  len := length(temp);
-  if len > length(res) then
-    len := length(res);
-
-  JLString(temp).getChars(0,len,res,0);
-  JUArrays.fill(res,len,high(res),#0);
-end;
-
-(*
-procedure fpc_shortstr_to_unicodechararray(out res: array of unicodechar; const src: ShortString); compilerproc;
-var
-  len: longint;
-  temp : unicodestring;
-begin
-  len := length(src);
-  { temp is initialized with an empty string, so no need to convert src in case
-    it's also empty}
-  if len > 0 then
-    temp:=src;
-  len := length(temp);
-  if len > high(res)+1 then
-    len := high(res)+1;
-
-  JLString(temp).getChars(0,len,res,0);
-  JUArrays.fill(res,len,high(res),#0);
-end;
-*)
-procedure fpc_ansistr_to_widechararray(out res: array of widechar; const src: AnsiString); compilerproc;
-var
-  len: SizeInt;
-  temp: widestring;
-begin
-  len := length(src);
-  { make sure we don't dereference src if it can be nil (JM) }
-  if len > 0 then
-    temp:=src;
-  len := length(temp);
-  if len > high(res)+1 then
-    len := high(res)+1;
-
-  JLString(temp).getChars(0,len,res,0);
-  JUArrays.fill(res,len,high(res),#0);
-end;
-
-procedure fpc_shortstr_to_widechararray(out res: array of widechar; const src: ShortString); compilerproc;
-var
-  len: longint;
-  temp : unicodestring;
-begin
-  len := length(src);
-  { temp is initialized with an empty string, so no need to convert src in case
-    it's also empty}
-  if len > 0 then
-    temp:=src;
-  len := length(temp);
-  if len > high(res)+1 then
-    len := high(res)+1;
-
-  JLString(temp).getChars(0,len,res,0);
-  JUArrays.fill(res,len,high(res),#0);
-end;
-
-procedure fpc_unicodestr_to_widechararray(out res: array of widechar; const src: UnicodeString); compilerproc;
-var
-  i, len: SizeInt;
-begin
-  len := length(src);
-  if len > length(res) then
-    len := length(res);
-  JLString(src).getChars(0,len,res,0);
-end;
-
-
-Function fpc_UnicodeStr_Compare(const S1,S2 : UnicodeString): SizeInt; compilerproc;
-{
-  Compares 2 UnicodeStrings;
-  The result is
-   <0 if S1<S2
-   0 if S1=S2
-   >0 if S1>S2
-}
-Var
-  MaxI,Temp : SizeInt;
-begin
-  if JLObject(S1)=JLObject(S2) then
-   begin
-     result:=0;
-     exit;
-   end;
-  result:=JLString(S1).compareTo(S2);
-end;
-
-Function fpc_UnicodeStr_Compare_Equal(const S1,S2 : UnicodeString): SizeInt; compilerproc;
-{
-  Compares 2 UnicodeStrings for equality only;
-  The result is
-   0 if S1=S2
-   <>0 if S1<>S2
-}
-Var
-  MaxI : SizeInt;
-begin
-  result:=ord(not JLString(S1).equals(JLString(S2)));
-end;
-
-function fpc_UnicodeStr_SetLength(const S : UnicodeString; l : SizeInt): UnicodeString; compilerproc;
-{
-  Sets The length of string S to L.
-  Makes sure S is unique, and contains enough room.
-  Returns new val
-}
-Var
-  movelen: SizeInt;
-  chars: array of widechar;
-  strlen: SizeInt;
-begin
-   if (l>0) then
-    begin
-      if JLObject(S)=nil then
-       begin
-         { Need a completely new string...}
-         result:=NewUnicodeString(l);
-       end
-      { no need to create a new string, since Java strings are immutable }
-      else
-        begin
-          strlen:=length(s);
-          if l=strlen then
-            result:=s
-          else if (l<strlen) then
-            result:=JLString(s).substring(0,l)
-          else
-            begin
-              setlength(chars,l);
-              JLString(s).getChars(0,strlen,chars,0);
-              result:=JLString.create(chars,0,l)
-            end;
-        end
-    end
-  else
-    begin
-      result:='';
-    end;
-end;
-
-{*****************************************************************************
-                     Public functions, In interface.
-*****************************************************************************}
-(*
-function UnicodeCharToString(S : PUnicodeChar) : AnsiString;
-  begin
-     result:=UnicodeCharLenToString(s,Length(UnicodeString(s)));
-  end;
-
-function StringToUnicodeChar(const Src : AnsiString;Dest : PUnicodeChar;DestSize : SizeInt) : PUnicodeChar;
-  var
-    temp:unicodestring;
-  begin
-     widestringmanager.Ansi2UnicodeMoveProc(PChar(Src),temp,Length(Src));
-     if Length(temp)<DestSize then
-       move(temp[1],Dest^,Length(temp)*SizeOf(UnicodeChar))
-     else
-       move(temp[1],Dest^,(DestSize-1)*SizeOf(UnicodeChar));
-
-     Dest[DestSize-1]:=#0;
-
-     result:=Dest;
-
-  end;
-
-
-function WideCharToString(S : PWideChar) : AnsiString;
-  begin
-     result:=WideCharLenToString(s,Length(WideString(s)));
-  end;
-
-
-function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
-  var
-    temp:widestring;
-  begin
-     widestringmanager.Ansi2WideMoveProc(PChar(Src),temp,Length(Src));
-     if Length(temp)<DestSize then
-       move(temp[1],Dest^,Length(temp)*SizeOf(WideChar))
-     else
-       move(temp[1],Dest^,(DestSize-1)*SizeOf(WideChar));
-
-     Dest[DestSize-1]:=#0;
-
-     result:=Dest;
-
-  end;
-
-
-function UnicodeCharLenToString(S : PUnicodeChar;Len : SizeInt) : AnsiString;
-  begin
-     //SetLength(result,Len);
-     widestringmanager.Unicode2AnsiMoveproc(S,result,Len);
-  end;
-
-
-procedure UnicodeCharLenToStrVar(Src : PUnicodeChar;Len : SizeInt;out Dest : AnsiString);
-  begin
-     Dest:=UnicodeCharLenToString(Src,Len);
-  end;
-
-
-procedure UnicodeCharToStrVar(S : PUnicodeChar;out Dest : AnsiString);
-  begin
-     Dest:=UnicodeCharToString(S);
-  end;
-
-
-function WideCharLenToString(S : PWideChar;Len : SizeInt) : AnsiString;
-  begin
-     //SetLength(result,Len);
-     widestringmanager.Wide2AnsiMoveproc(S,result,Len);
-  end;
-
-
-procedure WideCharLenToStrVar(Src : PWideChar;Len : SizeInt;out Dest : AnsiString);
-  begin
-     Dest:=WideCharLenToString(Src,Len);
-  end;
-
-
-procedure WideCharToStrVar(S : PWideChar;out Dest : AnsiString);
-  begin
-     Dest:=WideCharToString(S);
-  end;
-*)
-
-Function fpc_unicodestr_Unique(const S : JLObject): JLObject; compilerproc;
-begin
-  result:=s;
-end;
-
-
-Function Fpc_UnicodeStr_Copy (Const S : UnicodeString; Index,Size : SizeInt) : UnicodeString;compilerproc;
-begin
-  dec(index);
-  if Index < 0 then
-    Index := 0;
-  { Check Size. Accounts for Zero-length S, the double check is needed because
-    Size can be maxint and will get <0 when adding index }
-  if (Size>Length(S)) or
-     (Index+Size>Length(S)) then
-   Size:=Length(S)-Index;
-  If Size>0 then
-    result:=JLString(s).subString(Index,Size)
-  else
-    result:='';
-end;
-
-
-Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString) : SizeInt;
-begin
-  Pos:=0;
-  if Length(SubStr)>0 then
-    Pos:=JLString(Source).indexOf(SubStr)+1;
-end;
-
-
-{ Faster version for a unicodechar alone }
-Function Pos (c : UnicodeChar; Const s : UnicodeString) : SizeInt;
-begin
-  Pos:=0;
-  if length(S)>0 then
-    Pos:=JLString(s).indexOf(ord(c))+1;
-end;
-
-(*
-Function Pos (c : AnsiString; Const s : UnicodeString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-  begin
-    result:=Pos(UnicodeString(c),s);
-  end;
-
-
-Function Pos (c : ShortString; Const s : UnicodeString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-  begin
-    result:=Pos(UnicodeString(c),s);
-  end;
-
-
-Function Pos (c : UnicodeString; Const s : AnsiString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-  begin
-    result:=Pos(c,UnicodeString(s));
-  end;
-*)
-
-{ Faster version for a char alone. Must be implemented because   }
-{ pos(c: char; const s: shortstring) also exists, so otherwise   }
-{ using pos(char,pchar) will always call the shortstring version }
-{ (exact match for first argument), also with $h+ (JM)           }
-Function Pos (c : AnsiChar; Const s : UnicodeString) : SizeInt;
-var
-  i: SizeInt;
-  wc : unicodechar;
-begin
-  wc:=c;
-  result:=Pos(wc,s);
-end;
-
-(*
-Procedure Delete (Var S : UnicodeString; Index,Size: SizeInt);
-Var
-  LS : SizeInt;
-  sb: JLStringBuilder;
-begin
-  LS:=Length(S);
-  if (Index>LS) or (Index<=0) or (Size<=0) then
-    exit;
-
-  { (Size+Index) will overflow if Size=MaxInt. }
-  if Size>LS-Index then
-    Size:=LS-Index+1;
-  if Size<=LS-Index then
-    begin
-      Dec(Index);
-      sb:=JLStringBuilder.Create(s);
-      sb.delete(index,size);
-      s:=sb.toString;
-    end
-  else
-    s:=JLString(s).substring(0,index-1);
-end;
-
-
-Procedure Insert (Const Source : UnicodeString; Var S : UnicodeString; Index : SizeInt);
-var
-  Temp : UnicodeString;
-  LS : SizeInt;
-  sb : JLStringBuilder;
-begin
-  If Length(Source)=0 then
-   exit;
-  if index <= 0 then
-   index := 1;
-  Ls:=Length(S);
-  if index > LS then
-   index := LS+1;
-  Dec(Index);
-  sb:=JLStringBuilder.Create(S);
-  sb.insert(Index,Source);
-  S:=sb.toString;
-end;
-*)
-
-Function  UpCase(c:UnicodeChar):UnicodeChar;
-begin
-  result:=JLCharacter.toUpperCase(c);
-end;
-
-
-function UpCase(const s : UnicodeString) : UnicodeString;
-begin
-  result:=JLString(s).toUpperCase;
-end;
-
-(*
-Procedure SetString (Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt);
-begin
-  SetLength(S,Len);
-  If (Buf<>Nil) and (Len>0) then
-    Move (Buf[0],S[1],Len*sizeof(UnicodeChar));
-end;
-
-
-Procedure SetString (Out S : UnicodeString; Buf : PChar; Len : SizeInt);
-var
-  BufLen: SizeInt;
-begin
-  SetLength(S,Len);
-  If (Buf<>Nil) and (Len>0) then
-    widestringmanager.Ansi2UnicodeMoveProc(Buf,S,Len);
-end;
-
-{$ifndef FPUNONE}
-Function fpc_Val_Real_UnicodeStr(Const S : UnicodeString; out Code : ValSInt): ValReal; [public, alias:'FPC_VAL_REAL_UNICODESTR']; compilerproc;
-Var
-  SS : String;
-begin
-  fpc_Val_Real_UnicodeStr := 0;
-  if length(S) > 255 then
-    code := 256
-  else
-    begin
-      SS := S;
-      Val(SS,fpc_Val_Real_UnicodeStr,code);
-    end;
-end;
-{$endif}
-
-function fpc_val_enum_unicodestr(str2ordindex:pointer;const s:unicodestring;out code:valsint):longint;compilerproc;
-
-var ss:shortstring;
-
-begin
-  if length(s)>255 then
-    code:=256
-  else
-    begin
-      ss:=s;
-      val(ss,fpc_val_enum_unicodestr,code);
-    end;
-end;
-
-Function fpc_Val_Currency_UnicodeStr(Const S : UnicodeString; out Code : ValSInt): Currency; [public, alias:'FPC_VAL_CURRENCY_UNICODESTR']; compilerproc;
-Var
-  SS : String;
-begin
-  if length(S) > 255 then
-    begin
-      fpc_Val_Currency_UnicodeStr:=0;
-      code := 256;
-    end
-  else
-    begin
-      SS := S;
-      Val(SS,fpc_Val_Currency_UnicodeStr,code);
-    end;
-end;
-
-
-Function fpc_Val_UInt_UnicodeStr (Const S : UnicodeString; out Code : ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_UNICODESTR']; compilerproc;
-Var
-  SS : ShortString;
-begin
-  fpc_Val_UInt_UnicodeStr := 0;
-  if length(S) > 255 then
-    code := 256
-  else
-    begin
-      SS := S;
-      Val(SS,fpc_Val_UInt_UnicodeStr,code);
-    end;
-end;
-
-
-Function fpc_Val_SInt_UnicodeStr (DestSize: SizeInt; Const S : UnicodeString; out Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_UNICODESTR']; compilerproc;
-Var
-  SS : ShortString;
-begin
-  fpc_Val_SInt_UnicodeStr:=0;
-  if length(S)>255 then
-    code:=256
-  else
-    begin
-      SS := S;
-      fpc_Val_SInt_UnicodeStr := int_Val_SInt_ShortStr(DestSize,SS,Code);
-    end;
-end;
-
-
-{$ifndef CPU64}
-
-Function fpc_Val_qword_UnicodeStr (Const S : UnicodeString; out Code : ValSInt): qword; [public, alias:'FPC_VAL_QWORD_UNICODESTR']; compilerproc;
-Var
-  SS : ShortString;
-begin
-  fpc_Val_qword_UnicodeStr:=0;
-  if length(S)>255 then
-    code:=256
-  else
-    begin
-       SS := S;
-       Val(SS,fpc_Val_qword_UnicodeStr,Code);
-    end;
-end;
-
-
-Function fpc_Val_int64_UnicodeStr (Const S : UnicodeString; out Code : ValSInt): Int64; [public, alias:'FPC_VAL_INT64_UNICODESTR']; compilerproc;
-Var
-  SS : ShortString;
-begin
-  fpc_Val_int64_UnicodeStr:=0;
-  if length(S)>255 then
-    code:=256
-  else
-    begin
-       SS := S;
-       Val(SS,fpc_Val_int64_UnicodeStr,Code);
-    end;
-end;
-
-{$endif CPU64}
-
-
-{$ifndef FPUNONE}
-procedure fpc_UnicodeStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : UnicodeString);compilerproc;
-var
-  ss : shortstring;
-begin
-  str_real(len,fr,d,treal_type(rt),ss);
-  s:=ss;
-end;
-{$endif}
-
-procedure fpc_unicodestr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:unicodestring);compilerproc;
-
-var ss:shortstring;
-
-begin
-  fpc_shortstr_enum(ordinal,len,typinfo,ord2strindex,ss);
-  s:=ss;
-end;
-
-procedure fpc_unicodestr_bool(b : boolean;len:sizeint;out s:unicodestring);compilerproc;
-
-var ss:shortstring;
-
-begin
-  fpc_shortstr_bool(b,len,ss);
-  s:=ss;
-end;
-
-{$ifdef FPC_HAS_STR_CURRENCY}
-procedure fpc_UnicodeStr_Currency(c : Currency;len,fr : SizeInt;out s : UnicodeString);compilerproc;
-var
-  ss : shortstring;
-begin
-  str(c:len:fr,ss);
-  s:=ss;
-end;
-{$endif FPC_HAS_STR_CURRENCY}
-
-Procedure fpc_UnicodeStr_SInt(v : ValSint; Len : SizeInt; out S : UnicodeString);compilerproc;
-Var
-  SS : ShortString;
-begin
-  Str (v:Len,SS);
-  S:=SS;
-end;
-
-
-Procedure fpc_UnicodeStr_UInt(v : ValUInt;Len : SizeInt; out S : UnicodeString);compilerproc;
-Var
-  SS : ShortString;
-begin
-  str(v:Len,SS);
-  S:=SS;
-end;
-
-
-{$ifndef CPU64}
-
-Procedure fpc_UnicodeStr_Int64(v : Int64; Len : SizeInt; out S : UnicodeString);compilerproc;
-Var
-  SS : ShortString;
-begin
-  Str (v:Len,SS);
-  S:=SS;
-end;
-
-
-Procedure fpc_UnicodeStr_Qword(v : Qword;Len : SizeInt; out S : UnicodeString);compilerproc;
-Var
-  SS : ShortString;
-begin
-  str(v:Len,SS);
-  S:=SS;
-end;
-
-{$endif CPU64}
-*)
-
-(*
-{ converts an utf-16 code point or surrogate pair to utf-32 }
-function utf16toutf32(const S: UnicodeString; const index: SizeInt; out len: longint): UCS4Char; [public, alias: 'FPC_UTF16TOUTF32'];
-var
-  w: unicodechar;
-begin
-  { UTF-16 points in the range #$0-#$D7FF and #$E000-#$FFFF }
-  { are the same in UTF-32                                  }
-  w:=s[index];
-  if (w<=#$d7ff) or
-     (w>=#$e000) then
-    begin
-      result:=UCS4Char(w);
-      len:=1;
-    end
-  { valid surrogate pair? }
-  else if (w<=#$dbff) and
-          { w>=#$d7ff check not needed, checked above }
-          (index<length(s)) and
-          (s[index+1]>=#$dc00) and
-          (s[index+1]<=#$dfff) then
-      { convert the surrogate pair to UTF-32 }
-    begin
-      result:=(UCS4Char(w)-$d800) shl 10 + (UCS4Char(s[index+1])-$dc00) + $10000;
-      len:=2;
-    end
-  else
-    { invalid surrogate -> do nothing }
-    begin
-      result:=UCS4Char(w);
-      len:=1;
-    end;
-end;
-
-
-function UnicodeToUtf8(Dest: PChar; Source: PUnicodeChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-  begin
-    if assigned(Source) then
-      Result:=UnicodeToUtf8(Dest,MaxBytes,Source,IndexWord(Source^,-1,0))
-    else
-      Result:=0;
-  end;
-
-
-function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PUnicodeChar; SourceChars: SizeUInt): SizeUInt;
-  var
-    i,j : SizeUInt;
-    w : word;
-    lw : longword;
-    len : longint;
-  begin
-    result:=0;
-    if source=nil then
-      exit;
-    i:=0;
-    j:=0;
-    if assigned(Dest) then
-      begin
-        while (i<SourceChars) and (j<MaxDestBytes) do
-          begin
-            w:=word(Source[i]);
-            case w of
-              0..$7f:
-                begin
-                  Dest[j]:=char(w);
-                  inc(j);
-                end;
-              $80..$7ff:
-                begin
-                  if j+1>=MaxDestBytes then
-                    break;
-                  Dest[j]:=char($c0 or (w shr 6));
-                  Dest[j+1]:=char($80 or (w and $3f));
-                  inc(j,2);
-                end;
-              $800..$d7ff,$e000..$ffff:
-                begin
-                  if j+2>=MaxDestBytes then
-                    break;
-                  Dest[j]:=char($e0 or (w shr 12));
-                  Dest[j+1]:=char($80 or ((w shr 6) and $3f));
-                  Dest[j+2]:=char($80 or (w and $3f));
-                  inc(j,3);
-                end;
-              $d800..$dbff:
-                {High Surrogates}
-                begin
-                  if j+3>=MaxDestBytes then
-                    break;
-                  if (i<sourcechars-1) and
-                     (word(Source[i+1]) >= $dc00) and
-                     (word(Source[i+1]) <= $dfff) then
-                    begin
-                      lw:=longword(utf16toutf32(Source[i] + Source[i+1], 1, len));
-                      Dest[j]:=char($f0 or (lw shr 18));
-                      Dest[j+1]:=char($80 or ((lw shr 12) and $3f));
-                      Dest[j+2]:=char($80 or ((lw shr 6) and $3f));
-                      Dest[j+3]:=char($80 or (lw and $3f));
-                      inc(j,4);
-                      inc(i);
-                    end;
-                end;
-              end;
-            inc(i);
-          end;
-
-        if j>SizeUInt(MaxDestBytes-1) then
-          j:=MaxDestBytes-1;
-
-        Dest[j]:=#0;
-      end
-    else
-      begin
-        while i<SourceChars do
-          begin
-            case word(Source[i]) of
-              $0..$7f:
-                inc(j);
-              $80..$7ff:
-                inc(j,2);
-              $800..$d7ff,$e000..$ffff:
-                inc(j,3);
-              $d800..$dbff:
-                begin
-                  if (i<sourcechars-1) and
-                     (word(Source[i+1]) >= $dc00) and
-                     (word(Source[i+1]) <= $dfff) then
-                    begin
-                      inc(j,4);
-                      inc(i);
-                    end;
-                end;
-            end;
-            inc(i);
-          end;
-      end;
-    result:=j+1;
-  end;
-
-
-function Utf8ToUnicode(Dest: PUnicodeChar; Source: PChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-  begin
-    if assigned(Source) then
-      Result:=Utf8ToUnicode(Dest,MaxChars,Source,strlen(Source))
-    else
-      Result:=0;
-  end;
-
-
-function UTF8ToUnicode(Dest: PUnicodeChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt): SizeUInt;
-  const
-    UNICODE_INVALID=63;
-  var
-    InputUTF8: SizeUInt;
-    IBYTE: BYTE;
-    OutputUnicode: SizeUInt;
-    PRECHAR: SizeUInt;
-    TempBYTE: BYTE;
-    CharLen: SizeUint;
-    LookAhead: SizeUInt;
-    UC: SizeUInt;
-  begin
-    if not assigned(Source) then
-      begin
-        result:=0;
-        exit;
-      end;
-    result:=SizeUInt(-1);
-    InputUTF8:=0;
-    OutputUnicode:=0;
-    PreChar:=0;
-    if Assigned(Dest) Then
-      begin
-        while (OutputUnicode<MaxDestChars) and (InputUTF8<SourceBytes) do
-          begin
-            IBYTE:=byte(Source[InputUTF8]);
-            if (IBYTE and $80) = 0 then
-              begin
-                //One character US-ASCII, convert it to unicode
-                if IBYTE = 10 then
-                  begin
-                    If (PreChar<>13) and FALSE then
-                      begin
-                        //Expand to crlf, conform UTF-8.
-                        //This procedure will break the memory alocation by
-                        //FPC for the widestring, so never use it. Condition never true due the "and FALSE".
-                        if OutputUnicode+1<MaxDestChars then
-                          begin
-                            Dest[OutputUnicode]:=WideChar(13);
-                            inc(OutputUnicode);
-                            Dest[OutputUnicode]:=WideChar(10);
-                            inc(OutputUnicode);
-                            PreChar:=10;
-                          end
-                        else
-                          begin
-                            Dest[OutputUnicode]:=WideChar(13);
-                            inc(OutputUnicode);
-                          end;
-                      end
-                    else
-                      begin
-                        Dest[OutputUnicode]:=WideChar(IBYTE);
-                        inc(OutputUnicode);
-                        PreChar:=IBYTE;
-                      end;
-                  end
-                else
-                  begin
-                    Dest[OutputUnicode]:=WideChar(IBYTE);
-                    inc(OutputUnicode);
-                    PreChar:=IBYTE;
-                  end;
-                inc(InputUTF8);
-              end
-            else
-              begin
-                TempByte:=IBYTE;
-                CharLen:=0;
-                while (TempBYTE and $80)<>0 do
-                  begin
-                    TempBYTE:=(TempBYTE shl 1) and $FE;
-                    inc(CharLen);
-                  end;
-                //Test for the "CharLen" conforms UTF-8 string
-                //This means the 10xxxxxx pattern.
-                if SizeUInt(InputUTF8+CharLen-1)>SourceBytes then
-                  begin
-                    //Insuficient chars in string to decode
-                    //UTF-8 array. Fallback to single char.
-                    CharLen:= 1;
-                  end;
-                for LookAhead := 1 to CharLen-1 do
-                  begin
-                    if ((byte(Source[InputUTF8+LookAhead]) and $80)<>$80) or
-                       ((byte(Source[InputUTF8+LookAhead]) and $40)<>$00) then
-                      begin
-                        //Invalid UTF-8 sequence, fallback.
-                        CharLen:= LookAhead;
-                        break;
-                      end;
-                  end;
-                UC:=$FFFF;
-                case CharLen of
-                  1:  begin
-                        //Not valid UTF-8 sequence
-                        UC:=UNICODE_INVALID;
-                      end;
-                  2:  begin
-                        //Two bytes UTF, convert it
-                        UC:=(byte(Source[InputUTF8]) and $1F) shl 6;
-                        UC:=UC or (byte(Source[InputUTF8+1]) and $3F);
-                        if UC <= $7F then
-                          begin
-                            //Invalid UTF sequence.
-                            UC:=UNICODE_INVALID;
-                          end;
-                      end;
-                  3:  begin
-                        //Three bytes, convert it to unicode
-                        UC:= (byte(Source[InputUTF8]) and $0F) shl 12;
-                        UC:= UC or ((byte(Source[InputUTF8+1]) and $3F) shl 6);
-                        UC:= UC or ((byte(Source[InputUTF8+2]) and $3F));
-                        if (UC <= $7FF) or (UC >= $FFFE) or ((UC >= $D800) and (UC <= $DFFF)) then
-                          begin
-                            //Invalid UTF-8 sequence
-                            UC:= UNICODE_INVALID;
-                          End;
-                      end;
-                  4:  begin
-                        //Four bytes, convert it to two unicode characters
-                        UC:= (byte(Source[InputUTF8]) and $07) shl 18;
-                        UC:= UC or ((byte(Source[InputUTF8+1]) and $3F) shl 12);
-                        UC:= UC or ((byte(Source[InputUTF8+2]) and $3F) shl 6);
-                        UC:= UC or ((byte(Source[InputUTF8+3]) and $3F));
-                        if (UC < $10000) or (UC > $10FFFF) then
-                          begin
-                            UC:= UNICODE_INVALID;
-                          end
-                        else
-                          begin
-                            { only store pair if room }
-                            dec(UC,$10000);
-                            if (OutputUnicode<MaxDestChars-1) then
-                              begin
-                                Dest[OutputUnicode]:=WideChar(UC shr 10 + $D800);
-                                inc(OutputUnicode);
-                                UC:=(UC and $3ff) + $DC00;
-                              end
-                            else
-                              begin
-                                InputUTF8:= InputUTF8 + CharLen;
-                                { don't store anything }
-                                CharLen:=0;
-                              end;
-                          end;
-                      end;
-                  5,6,7:  begin
-                            //Invalid UTF8 to unicode conversion,
-                            //mask it as invalid UNICODE too.
-                            UC:=UNICODE_INVALID;
-                          end;
-                end;
-                if CharLen > 0 then
-                  begin
-                    PreChar:=UC;
-                    Dest[OutputUnicode]:=WideChar(UC);
-                    inc(OutputUnicode);
-                  end;
-                InputUTF8:= InputUTF8 + CharLen;
-              end;
-          end;
-        Result:=OutputUnicode+1;
-      end
-    else
-      begin
-        while (InputUTF8<SourceBytes) do
-          begin
-            IBYTE:=byte(Source[InputUTF8]);
-            if (IBYTE and $80) = 0 then
-              begin
-                //One character US-ASCII, convert it to unicode
-                if IBYTE = 10 then
-                  begin
-                    if (PreChar<>13) and FALSE then
-                      begin
-                        //Expand to crlf, conform UTF-8.
-                        //This procedure will break the memory alocation by
-                        //FPC for the widestring, so never use it. Condition never true due the "and FALSE".
-                        inc(OutputUnicode,2);
-                        PreChar:=10;
-                      end
-                    else
-                      begin
-                        inc(OutputUnicode);
-                        PreChar:=IBYTE;
-                      end;
-                  end
-                else
-                  begin
-                    inc(OutputUnicode);
-                    PreChar:=IBYTE;
-                  end;
-                inc(InputUTF8);
-              end
-            else
-              begin
-                TempByte:=IBYTE;
-                CharLen:=0;
-                while (TempBYTE and $80)<>0 do
-                  begin
-                    TempBYTE:=(TempBYTE shl 1) and $FE;
-                    inc(CharLen);
-                  end;
-                //Test for the "CharLen" conforms UTF-8 string
-                //This means the 10xxxxxx pattern.
-                if SizeUInt(InputUTF8+CharLen-1)>SourceBytes then
-                  begin
-                    //Insuficient chars in string to decode
-                    //UTF-8 array. Fallback to single char.
-                    CharLen:= 1;
-                  end;
-                for LookAhead := 1 to CharLen-1 do
-                  begin
-                    if ((byte(Source[InputUTF8+LookAhead]) and $80)<>$80) or
-                       ((byte(Source[InputUTF8+LookAhead]) and $40)<>$00) then
-                      begin
-                        //Invalid UTF-8 sequence, fallback.
-                        CharLen:= LookAhead;
-                        break;
-                      end;
-                  end;
-                UC:=$FFFF;
-                case CharLen of
-                  1:  begin
-                        //Not valid UTF-8 sequence
-                        UC:=UNICODE_INVALID;
-                      end;
-                  2:  begin
-                        //Two bytes UTF, convert it
-                        UC:=(byte(Source[InputUTF8]) and $1F) shl 6;
-                        UC:=UC or (byte(Source[InputUTF8+1]) and $3F);
-                        if UC <= $7F then
-                          begin
-                            //Invalid UTF sequence.
-                            UC:=UNICODE_INVALID;
-                          end;
-                      end;
-                  3:  begin
-                        //Three bytes, convert it to unicode
-                        UC:= (byte(Source[InputUTF8]) and $0F) shl 12;
-                        UC:= UC or ((byte(Source[InputUTF8+1]) and $3F) shl 6);
-                        UC:= UC or ((byte(Source[InputUTF8+2]) and $3F));
-                        If (UC <= $7FF) or (UC >= $FFFE) or ((UC >= $D800) and (UC <= $DFFF)) then
-                          begin
-                            //Invalid UTF-8 sequence
-                            UC:= UNICODE_INVALID;
-                          end;
-                      end;
-                  4:  begin
-                        //Four bytes, convert it to two unicode characters
-                        UC:= (byte(Source[InputUTF8]) and $07) shl 18;
-                        UC:= UC or ((byte(Source[InputUTF8+1]) and $3F) shl 12);
-                        UC:= UC or ((byte(Source[InputUTF8+2]) and $3F) shl 6);
-                        UC:= UC or ((byte(Source[InputUTF8+3]) and $3F));
-                        if (UC < $10000) or (UC > $10FFFF) then
-                          UC:= UNICODE_INVALID
-                        else
-                          { extra character character }
-                          inc(OutputUnicode);
-                      end;
-                  5,6,7:  begin
-                            //Invalid UTF8 to unicode conversion,
-                            //mask it as invalid UNICODE too.
-                            UC:=UNICODE_INVALID;
-                          end;
-                end;
-                if CharLen > 0 then
-                  begin
-                    PreChar:=UC;
-                    inc(OutputUnicode);
-                  end;
-                InputUTF8:= InputUTF8 + CharLen;
-              end;
-          end;
-        Result:=OutputUnicode+1;
-      end;
-  end;
-
-
-function UTF8Encode(const s : Ansistring) : UTF8String; inline;
-  begin
-    Result:=UTF8Encode(UnicodeString(s));
-  end;
-
-
-function UTF8Encode(const s : UnicodeString) : UTF8String;
-  var
-    i : SizeInt;
-    hs : UTF8String;
-  begin
-    result:='';
-    if s='' then
-      exit;
-    SetLength(hs,length(s)*3);
-    i:=UnicodeToUtf8(pchar(hs),length(hs)+1,PUnicodeChar(s),length(s));
-    if i>0 then
-      begin
-        SetLength(hs,i-1);
-        result:=hs;
-      end;
-  end;
-
-
-function UTF8Decode(const s : UTF8String): UnicodeString;
-  var
-    i : SizeInt;
-    hs : UnicodeString;
-  begin
-    result:='';
-    if s='' then
-      exit;
-    SetLength(hs,length(s));
-    i:=Utf8ToUnicode(PUnicodeChar(hs),length(hs)+1,pchar(s),length(s));
-    if i>0 then
-      begin
-        SetLength(hs,i-1);
-        result:=hs;
-      end;
-  end;
-
-
-function AnsiToUtf8(const s : ansistring): UTF8String;{$ifdef SYSTEMINLINE}inline;{$endif}
-  begin
-    Result:=Utf8Encode(s);
-  end;
-
-
-function Utf8ToAnsi(const s : UTF8String) : ansistring;{$ifdef SYSTEMINLINE}inline;{$endif}
-  begin
-    Result:=Utf8Decode(s);
-  end;
-
-
-function UnicodeStringToUCS4String(const s : UnicodeString) : UCS4String;
-  var
-    i, slen,
-    destindex : SizeInt;
-    len       : longint;
-  begin
-    slen:=length(s);
-    setlength(result,slen+1);
-    i:=1;
-    destindex:=0;
-    while (i<=slen) do
-      begin
-        result[destindex]:=utf16toutf32(s,i,len);
-        inc(destindex);
-        inc(i,len);
-      end;
-    { destindex <= slen (surrogate pairs may have been merged) }
-    { destindex+1 for terminating #0 (dynamic arrays are       }
-    { implicitely filled with zero)                            }
-    setlength(result,destindex+1);
-  end;
-
-
-{ concatenates an utf-32 char to a unicodestring. S *must* be unique when entering. }
-procedure ConcatUTF32ToUnicodeStr(const nc: UCS4Char; var S: UnicodeString; var index: SizeInt);
-var
-  p : PUnicodeChar;
-begin
-  { if nc > $ffff, we need two places }
-  if (index+ord(nc > $ffff)>length(s)) then
-    if (length(s) < 10*256) then
-      setlength(s,length(s)+10)
-    else
-      setlength(s,length(s)+length(s) shr 8);
-  { we know that s is unique -> avoid uniquestring calls}
-  p:=@s[index];
-  if (nc<$ffff) then
-    begin
-      p^:=unicodechar(nc);
-      inc(index);
-    end
-  else if (dword(nc)<=$10ffff) then
-    begin
-      p^:=unicodechar((nc - $10000) shr 10 + $d800);
-      (p+1)^:=unicodechar((nc - $10000) and $3ff + $dc00);
-      inc(index,2);
-    end
-  else
-    { invalid code point }
-    begin
-      p^:='?';
-      inc(index);
-    end;
-end;
-
-
-function UCS4StringToUnicodeString(const s : UCS4String) : UnicodeString;
-  var
-    i        : SizeInt;
-    resindex : SizeInt;
-  begin
-    { skip terminating #0 }
-    SetLength(result,length(s)-1);
-    resindex:=1;
-    for i:=0 to high(s)-1 do
-      ConcatUTF32ToUnicodeStr(s[i],result,resindex);
-    { adjust result length (may be too big due to growing }
-    { for surrogate pairs)                                }
-    setlength(result,resindex-1);
-  end;
-
-
-function WideStringToUCS4String(const s : WideString) : UCS4String;
-  var
-    i, slen,
-    destindex : SizeInt;
-    len       : longint;
-  begin
-    slen:=length(s);
-    setlength(result,slen+1);
-    i:=1;
-    destindex:=0;
-    while (i<=slen) do
-      begin
-        result[destindex]:=utf16toutf32(s,i,len);
-        inc(destindex);
-        inc(i,len);
-      end;
-    { destindex <= slen (surrogate pairs may have been merged) }
-    { destindex+1 for terminating #0 (dynamic arrays are       }
-    { implicitely filled with zero)                            }
-    setlength(result,destindex+1);
-  end;
-
-
-{ concatenates an utf-32 char to a widestring. S *must* be unique when entering. }
-procedure ConcatUTF32ToWideStr(const nc: UCS4Char; var S: WideString; var index: SizeInt);
-var
-  p : PWideChar;
-begin
-  { if nc > $ffff, we need two places }
-  if (index+ord(nc > $ffff)>length(s)) then
-    if (length(s) < 10*256) then
-      setlength(s,length(s)+10)
-    else
-      setlength(s,length(s)+length(s) shr 8);
-  { we know that s is unique -> avoid uniquestring calls}
-  p:=@s[index];
-  if (nc<$ffff) then
-    begin
-      p^:=widechar(nc);
-      inc(index);
-    end
-  else if (dword(nc)<=$10ffff) then
-    begin
-      p^:=widechar((nc - $10000) shr 10 + $d800);
-      (p+1)^:=widechar((nc - $10000) and $3ff + $dc00);
-      inc(index,2);
-    end
-  else
-    { invalid code point }
-    begin
-      p^:='?';
-      inc(index);
-    end;
-end;
-
-
-function UCS4StringToWideString(const s : UCS4String) : WideString;
-  var
-    i        : SizeInt;
-    resindex : SizeInt;
-  begin
-    { skip terminating #0 }
-    SetLength(result,length(s)-1);
-    resindex:=1;
-    for i:=0 to high(s)-1 do
-      ConcatUTF32ToWideStr(s[i],result,resindex);
-    { adjust result length (may be too big due to growing }
-    { for surrogate pairs)                                }
-    setlength(result,resindex-1);
-  end;
-
-
-const
-  SNoUnicodestrings = 'This binary has no unicodestrings support compiled in.';
-  SRecompileWithUnicodestrings = 'Recompile the application with a unicodestrings-manager in the program uses clause.';
-*)
-
-function CompareUnicodeString(const s1, s2 : UnicodeString) : PtrInt;
-  begin
-    widestringmanager.collator.setStrength(JTCollator.IDENTICAL);
-    result:=widestringmanager.collator.compare(s1,s2);
-  end;
-
-
-function CompareTextUnicodeString(const s1, s2 : UnicodeString): PtrInt;
-  begin
-    widestringmanager.collator.setStrength(JTCollator.TERTIARY);
-    result:=widestringmanager.collator.compare(s1,s2);
-  end;
-
-constructor TUnicodeStringManager.create;
-  begin
-  end;
-
-
-procedure initunicodestringmanager;
-  begin
-    widestringmanager:=TUnicodeStringManager.create;
-    widestringmanager.collator:=JTCollator.getInstance;
-  end;
-

+ 4 - 0
tests/test/jvm/testall.bat

@@ -204,4 +204,8 @@ ppcjvm -O2 -g -B tval5
 if %errorlevel% neq 0 exit /b %errorlevel%
 java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. tval5
 if %errorlevel% neq 0 exit /b %errorlevel%
+ppcjvm -O2 -g -B tstring9
+if %errorlevel% neq 0 exit /b %errorlevel%
+java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. tstring9
+if %errorlevel% neq 0 exit /b %errorlevel%
 

+ 4 - 0
tests/test/jvm/testall.sh

@@ -112,3 +112,7 @@ $PPC -O2 -g -B tval
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/jvm-java:. tval
 $PPC -O2 -g -B tval5
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/jvm-java:. tval5
+$PPC -O2 -g -B tstring9
+java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/jvm-java:. tstring9
+$PPC -O2 -g -B tstr
+java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/jvm-java:. tstr

+ 583 - 0
tests/test/jvm/tstr.pp

@@ -0,0 +1,583 @@
+program tstr;
+
+uses
+  jdk15;
+
+{$macro on}
+{$define write:=JLSystem.fout.print}
+{$define writeln:=JLSystem.fout.println}
+
+
+{$ifdef fpc}
+  {$ifndef ver1_0}
+    {$define haswidestring}
+  {$endif}
+{$else}
+  {$ifndef ver70}
+    {$define haswidestring}
+  {$endif}
+{$endif}
+
+procedure test_shortstr;
+type
+  tlocalstring = shortstring;
+var
+  l: longint;
+  c: cardinal;
+  f: real;
+  i: int64;
+  q: qword;
+  s: tlocalstring;
+  len: byte;
+  frac: word;
+  longval : longint;
+
+  procedure check(const ss: tlocalstring);
+  begin
+    if s <> ss then
+      begin
+        writeln('error!');
+        halt(1);
+      end;
+  end;
+
+begin
+  writeln('testing str(<value>,shortstring)...');
+
+  l := -1;
+  str(l,s);
+  check('-1');
+  str(l:0,s);
+  check('-1');
+  str(l:1,s);
+  check('-1');
+  str(l:2,s);
+  check('-1');
+  str(l:3,s);
+  check(' -1');
+  len := 4;
+  str(l:len,s);
+  check('  -1');
+
+  c := 10;
+  str(c,s);
+  check('10');
+  str(c:0,s);
+  check('10');
+  str(c:1,s);
+  check('10');
+  str(c:2,s);
+  check('10');
+  str(c:3,s);
+  check(' 10');
+
+  { for more in-depth tests of str_real, see ../tstreal[1,2].pp }
+  f := -1.12345;
+{$IFOPT E-}
+  str(f,s);
+  if (sizeof(extended) = 10) or
+     (sizeof(extended) = 12) then
+    check('-1.12345000000000E+000')
+  else if sizeof(extended) = 8 then
+    check('-1.12345000000000E+000')
+  else
+    check('error, not yet implemented!!!!');
+{$endif}
+  { the number of exponents depends on the maaping of the real type }
+  if sizeof(real) = 8 then
+    begin
+      str(f:0,s);
+      check('-1.1E+000');
+      str(f:1,s);
+      check('-1.1E+000');
+      str(f:2,s);
+      check('-1.1E+000');
+      str(f:3,s);
+      check('-1.1E+000');
+      str(f:4,s);
+      check('-1.1E+000');
+    end
+  else
+    begin
+      str(f:0,s);
+      check('-1.1E+00');
+      str(f:1,s);
+      check('-1.1E+00');
+      str(f:2,s);
+      check('-1.1E+00');
+      str(f:3,s);
+      check('-1.1E+00');
+      str(f:4,s);
+      check('-1.1E+00');
+    end;
+  str(f:0:0,s);
+  check('-1');
+  str(f:0:1,s);
+  check('-1.1');
+  str(f:0:2,s);
+  check('-1.12');
+  str(f:1:0,s);
+  check('-1');
+  str(f:1:1,s);
+  check('-1.1');
+  str(f:5:0,s);
+  check('   -1');
+  str(f:5:1,s);
+  check(' -1.1');
+  str(f:5:2,s);
+  check('-1.12');
+  len := 6;
+  frac := 2;
+  str(f:len:frac,s);
+  check(' -1.12');
+
+  i := -1;
+  str(i,s);
+  check('-1');
+  str(i:0,s);
+  check('-1');
+  str(i:1,s);
+  check('-1');
+  str(i:2,s);
+  check('-1');
+  str(i:3,s);
+  check(' -1');
+  i:=655536;
+  str(i,s);
+  check('655536');
+  str(i:0,s);
+  check('655536');
+  str(i:1,s);
+  check('655536');
+  str(i:2,s);
+  check('655536');
+  str(i:3,s);
+  check('655536');
+  longval:=1;
+  i:=int64(longval) shl 33;
+  str(i,s);
+  check('8589934592');
+  str(i:0,s);
+  check('8589934592');
+  str(i:1,s);
+  check('8589934592');
+  str(i:2,s);
+  check('8589934592');
+  str(i:3,s);
+  check('8589934592');
+
+  q := 10;
+  str(q,s);
+  check('10');
+  str(q:0,s);
+  check('10');
+  str(q:1,s);
+  check('10');
+  str(q:2,s);
+  check('10');
+  str(q:3,s);
+  check(' 10');
+  q:=655536;
+  str(q,s);
+  check('655536');
+  str(q:0,s);
+  check('655536');
+  str(q:1,s);
+  check('655536');
+  str(q:2,s);
+  check('655536');
+  str(q:3,s);
+  check('655536');
+  longval:=1;
+  q:=qword(longval) shl 33;
+  str(q,s);
+  check('8589934592');
+  str(q:0,s);
+  check('8589934592');
+  str(q:1,s);
+  check('8589934592');
+  str(q:2,s);
+  check('8589934592');
+  str(q:3,s);
+  check('8589934592');
+end;
+
+(*
+procedure test_ansistr;
+type
+  tlocalstring = ansistring;
+var
+  l: longint;
+  c: cardinal;
+  f: real;
+  i: int64;
+  q: qword;
+  s: tlocalstring;
+  len: shortint;
+  frac: smallint;
+  longval : longint;
+
+  procedure check(const ss: tlocalstring);
+  begin
+    if s <> ss then
+      begin
+        writeln('error!');
+        halt(1);
+      end;
+  end;
+
+begin
+  writeln('testing str(<value>,ansistring)...');
+
+  l := -1;
+  str(l,s);
+  check('-1');
+  str(l:0,s);
+  check('-1');
+  str(l:1,s);
+  check('-1');
+  str(l:2,s);
+  check('-1');
+  str(l:3,s);
+  check(' -1');
+  len := 4;
+  str(l:len,s);
+  check('  -1');
+
+  c := 10;
+  str(c,s);
+  check('10');
+  str(c:0,s);
+  check('10');
+  str(c:1,s);
+  check('10');
+  str(c:2,s);
+  check('10');
+  str(c:3,s);
+  check(' 10');
+
+  { for more in-depth tests of str_real, see ../tstreal[1,2].pp }
+  f := -1.12345;
+{$IFOPT E-}
+  str(f,s);
+  if (sizeof(extended) = 10) or
+     (sizeof(extended) = 12) then
+    check('-1.12345000000000E+000')
+  else if sizeof(extended) = 8 then
+    check('-1.12345000000000E+000')
+  else
+    check('error, not yet implemented!!!!');
+{$endif}
+  { the number of exponents depends on the maaping of the real type }
+  if sizeof(real) = 8 then
+    begin
+      str(f:0,s);
+      check('-1.1E+000');
+      str(f:1,s);
+      check('-1.1E+000');
+      str(f:2,s);
+      check('-1.1E+000');
+      str(f:3,s);
+      check('-1.1E+000');
+      str(f:4,s);
+      check('-1.1E+000');
+    end
+  else
+    begin
+      str(f:0,s);
+      check('-1.1E+00');
+      str(f:1,s);
+      check('-1.1E+00');
+      str(f:2,s);
+      check('-1.1E+00');
+      str(f:3,s);
+      check('-1.1E+00');
+      str(f:4,s);
+      check('-1.1E+00');
+    end;
+  str(f:0:0,s);
+  check('-1');
+  str(f:0:1,s);
+  check('-1.1');
+  str(f:0:2,s);
+  check('-1.12');
+  str(f:1:0,s);
+  check('-1');
+  str(f:1:1,s);
+  check('-1.1');
+  str(f:5:0,s);
+  check('   -1');
+  str(f:5:1,s);
+  check(' -1.1');
+  str(f:5:2,s);
+  check('-1.12');
+  len := 6;
+  frac := 2;
+  str(f:len:frac,s);
+  check(' -1.12');
+
+  i := -1;
+  str(i,s);
+  check('-1');
+  str(i:0,s);
+  check('-1');
+  str(i:1,s);
+  check('-1');
+  str(i:2,s);
+  check('-1');
+  str(i:3,s);
+  check(' -1');
+  i:=655536;
+  str(i,s);
+  check('655536');
+  str(i:0,s);
+  check('655536');
+  str(i:1,s);
+  check('655536');
+  str(i:2,s);
+  check('655536');
+  str(i:3,s);
+  check('655536');
+  longval:=1;
+  i:=int64(longval) shl 33;
+  str(i,s);
+  check('8589934592');
+  str(i:0,s);
+  check('8589934592');
+  str(i:1,s);
+  check('8589934592');
+  str(i:2,s);
+  check('8589934592');
+  str(i:3,s);
+  check('8589934592');
+
+  q := 10;
+  str(q,s);
+  check('10');
+  str(q:0,s);
+  check('10');
+  str(q:1,s);
+  check('10');
+  str(q:2,s);
+  check('10');
+  str(q:3,s);
+  check(' 10');
+  q:=655536;
+  str(q,s);
+  check('655536');
+  str(q:0,s);
+  check('655536');
+  str(q:1,s);
+  check('655536');
+  str(q:2,s);
+  check('655536');
+  str(q:3,s);
+  check('655536');
+  longval:=1;
+  q:=qword(longval) shl 33;
+  str(q,s);
+  check('8589934592');
+  str(q:0,s);
+  check('8589934592');
+  str(q:1,s);
+  check('8589934592');
+  str(q:2,s);
+  check('8589934592');
+  str(q:3,s);
+  check('8589934592');
+end;
+*)
+
+{$ifdef haswidestring}
+procedure test_widestr;
+type
+  tlocalstring = widestring;
+var
+  l: longint;
+  c: cardinal;
+  f: real;
+  i: int64;
+  q: qword;
+  s: tlocalstring;
+  len: longint;
+  frac: cardinal;
+  longval : longint;
+
+  procedure check(const ss: tlocalstring);
+  begin
+    if s <> ss then
+      begin
+        writeln('error!');
+        halt(1);
+      end;
+  end;
+
+begin
+  writeln('testing str(<value>,widestring)...');
+
+  l := -1;
+  str(l,s);
+  check('-1');
+  str(l:0,s);
+  check('-1');
+  str(l:1,s);
+  check('-1');
+  str(l:2,s);
+  check('-1');
+  str(l:3,s);
+  check(' -1');
+  len := 4;
+  str(l:len,s);
+  check('  -1');
+
+  c := 10;
+  str(c,s);
+  check('10');
+  str(c:0,s);
+  check('10');
+  str(c:1,s);
+  check('10');
+  str(c:2,s);
+  check('10');
+  str(c:3,s);
+  check(' 10');
+
+  { for more in-depth tests of str_real, see ../tstreal[1,2].pp }
+  f := -1.12345;
+{$IFOPT E-}
+  str(f,s);
+  if sizeof(extended) = 10 then
+    check('-1.12345000000000E+000')
+  else if sizeof(extended) = 8 then
+    check('-1.12345000000000E+000')
+  else
+    check('error, not yet implemented!!!!');
+{$endif}
+  { the number of exponents depends on the maaping of the real type }
+  if sizeof(real) = 8 then
+    begin
+      str(f:0,s);
+      check('-1.1E+000');
+      str(f:1,s);
+      check('-1.1E+000');
+      str(f:2,s);
+      check('-1.1E+000');
+      str(f:3,s);
+      check('-1.1E+000');
+      str(f:4,s);
+      check('-1.1E+000');
+    end
+  else
+    begin
+      str(f:0,s);
+      check('-1.1E+00');
+      str(f:1,s);
+      check('-1.1E+00');
+      str(f:2,s);
+      check('-1.1E+00');
+      str(f:3,s);
+      check('-1.1E+00');
+      str(f:4,s);
+      check('-1.1E+00');
+    end;
+  str(f:0:0,s);
+  check('-1');
+  str(f:0:1,s);
+  check('-1.1');
+  str(f:0:2,s);
+  check('-1.12');
+  str(f:1:0,s);
+  check('-1');
+  str(f:1:1,s);
+  check('-1.1');
+  str(f:5:0,s);
+  check('   -1');
+  str(f:5:1,s);
+  check(' -1.1');
+  str(f:5:2,s);
+  check('-1.12');
+  len := 6;
+  frac := 2;
+  str(f:len:frac,s);
+  check(' -1.12');
+
+  i := -1;
+  str(i,s);
+  check('-1');
+  str(i:0,s);
+  check('-1');
+  str(i:1,s);
+  check('-1');
+  str(i:2,s);
+  check('-1');
+  str(i:3,s);
+  check(' -1');
+  i:=655536;
+  str(i,s);
+  check('655536');
+  str(i:0,s);
+  check('655536');
+  str(i:1,s);
+  check('655536');
+  str(i:2,s);
+  check('655536');
+  str(i:3,s);
+  check('655536');
+  longval:=1;
+  i:=int64(longval) shl 33;
+  str(i,s);
+  check('8589934592');
+  str(i:0,s);
+  check('8589934592');
+  str(i:1,s);
+  check('8589934592');
+  str(i:2,s);
+  check('8589934592');
+  str(i:3,s);
+  check('8589934592');
+
+  q := 10;
+  str(q,s);
+  check('10');
+  str(q:0,s);
+  check('10');
+  str(q:1,s);
+  check('10');
+  str(q:2,s);
+  check('10');
+  str(q:3,s);
+  check(' 10');
+  q:=655536;
+  str(q,s);
+  check('655536');
+  str(q:0,s);
+  check('655536');
+  str(q:1,s);
+  check('655536');
+  str(q:2,s);
+  check('655536');
+  str(q:3,s);
+  check('655536');
+  longval:=1;
+  q:=qword(longval) shl 33;
+  str(q,s);
+  check('8589934592');
+  str(q:0,s);
+  check('8589934592');
+  str(q:1,s);
+  check('8589934592');
+  str(q:2,s);
+  check('8589934592');
+  str(q:3,s);
+  check('8589934592');
+end;
+{$endif haswidestring}
+
+begin
+  test_shortstr;
+//  test_ansistr;
+{$ifdef haswidestring}
+  test_widestr;
+{$endif haswidestring}
+  writeln('str tests successful!');
+end.

+ 64 - 0
tests/test/jvm/tstring9.pp

@@ -0,0 +1,64 @@
+program tstring9
+;
+{$ifdef fpc}{$mode objfpc}{$h+}{$endif}
+
+uses
+  jdk15;
+
+{$macro on}
+{$define write:=JLSystem.fout.print}
+{$define writeln:=JLSystem.fout.println}
+
+var
+ a: array[0..0] of char = (#0);
+
+function test_pchar: boolean;
+var
+ s: string;
+ p: pchar;
+begin
+ p := '';
+ s := '1234567890';
+ s := p;
+ test_pchar := (s = '');
+ if not test_pchar then writeln('test_pchar failed');
+end;
+
+function test_chararray: boolean;
+var
+ s: string;
+begin
+ s := '1234567890';
+ s := a;
+ test_chararray := (s = '');
+ if not test_chararray then writeln('test_chararray failed');  
+end;
+
+function test_pchar_to_widestr: boolean;
+var
+ s: widestring;
+ p: PChar;
+begin
+ p := '';
+ s := '1234567890';
+ s := p;                         { win32: function result assign not optimized! }
+ test_pchar_to_widestr := (s = '');
+ if not test_pchar_to_widestr then writeln('test_pchar_to_widestr failed');  
+end;
+
+function test_chararray_to_widestr: boolean;
+var
+ s: widestring;
+begin
+ s := '1234567890';
+ s := a;
+ test_chararray_to_widestr := (s = '');
+ if not test_chararray_to_widestr then writeln('test_chararray_to_widestr failed');  
+end;
+
+begin
+ if not test_pchar then Halt(1);
+ if not test_chararray then Halt(2);
+ if not test_pchar_to_widestr then Halt(3);
+ if not test_chararray_to_widestr then Halt(4);
+end.

Некоторые файлы не были показаны из-за большого количества измененных файлов