# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: marian.edu@acorn.ro-20220214085025-sjhs35fa61crw5gw
# target_branch: sftp://medu@xfer.goldencode.com/opt/fwd/3821c
# testament_sha1: 816c6ece9597b538fc4de8147ac131088cd5853c
# timestamp: 2022-02-14 10:50:35 +0200
# base_revision_id: ca@goldencode.com-20220211104335-lnjxpgnygkwabkgx
# 
# Begin patch
=== modified file 'rules/annotations/method_defs.rules'
--- rules/annotations/method_defs.rules	2021-04-28 15:44:53 +0000
+++ rules/annotations/method_defs.rules	2021-10-28 07:59:30 +0000
@@ -34,6 +34,7 @@
 **     CA  20210203 Fixed a regression in invokeStandalone or invoke, for Progress.Lang.Class.
 **     CA  20210221 Copy 'qualified' annotation for property getter, to emit at the signature.
 **     CA  20210428 Fixed o:getClass():invoke() when it needs to be emitted as 'invokeStandalone'.
+**     ME  20211027 Fixed property class name when no getter defined (only set).
 */
 -->
 
@@ -296,9 +297,9 @@
             isAbstract = isIface or (copy.parent.isAnnotation("abstract") and
                                      getReferenceNoteBoolean(copy.parent.id, "abstract"))
          </action>
+         <action>cls = copy.parent.getAnnotation("classname")</action>
          
          <rule>type == prog.kw_get
-            <action>cls = copy.parent.getAnnotation("classname")</action>
             <rule>cls.equals("object") or cls.equals("jobject")
                <action>
                   objtype = copy.parent.getAnnotation("full-java-class")

=== modified file 'rules/annotations/naming.rules'
--- rules/annotations/naming.rules	2021-11-11 01:28:12 +0000
+++ rules/annotations/naming.rules	2022-02-11 15:26:27 +0000
@@ -48,6 +48,7 @@
 **                           the imported class name is the same name as the program with the 
 **                           import statement.
 **     CA  20210609          Fixed extent property used as output/input-output argument.
+**     ME  20211022          Send the AST node as input to loadConvertedClass call.
 **     OM  20211111          Added transaction support for finally blocks.
 */
  -->
@@ -298,7 +299,7 @@
          <!-- this needs to be done first -->
          <action>setConvertedClassName(file, ooname, fullpkg, classname)</action>
          <!-- map the source file name to the converted class naming info -->
-         <action>cclass = loadConvertedClass(file, true)</action>
+         <action>cclass = loadConvertedClass(file, true, this)</action>
       </rule>
       
       <rule>relativePath("METHOD_DEF/KW_METHOD/SYMBOL")

=== modified file 'rules/annotations/oo_references.rules'
--- rules/annotations/oo_references.rules	2021-07-08 15:49:35 +0000
+++ rules/annotations/oo_references.rules	2021-10-28 07:59:30 +0000
@@ -39,6 +39,7 @@
 **                  later on, when that is injected, the proper javaname is used.
 **     GES 20210701 Fix class name references which are to static members of a parent class. This is a 4GL
 **                  quirk.
+**     ME  20211022 Send the AST node as input to loadConvertedClass call.
 */
  -->
  
@@ -237,8 +238,10 @@
                <rule on="false">true
                   <!-- explicit class import -->
                   <action>fname = getNoteString("source-file")</action>
-                  <action>nameinfo = loadConvertedClass(fname, false)</action>
-                  <action>putNote("legacy-import", nameinfo.getQualifiedName())</action>
+                  <action>nameinfo = loadConvertedClass(fname, false, this)</action>
+                  <rule>nameinfo != null
+                     <action>putNote("legacy-import", nameinfo.getQualifiedName())</action>
+                  </rule>
                </rule>
             </rule>
          </rule>
@@ -274,7 +277,7 @@
             isNote("qualified") and isNote("source-file")
 
          <action>fname = getNoteString("source-file")</action>
-         <action>nameinfo = loadConvertedClass(fname, false)</action>
+         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
          
          <rule>nameinfo != null
             <action>oname = nameinfo.getQualifiedName()</action>
@@ -307,7 +310,7 @@
          <action>copy.parent.putAnnotation("source-file", getNoteString("source-file"))</action>
 
          <action>fname = getNoteString("source-file")</action>
-         <action>nameinfo = loadConvertedClass(fname, false)</action>
+         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
          
          <rule>nameinfo != null
             <action>copy.parent.putAnnotation("full-java-class", nameinfo.getQualifiedName())</action>
@@ -327,7 +330,7 @@
       
       <rule>this.type == prog.enum_value
          <action>fname = getNoteString("source-file")</action>
-         <action>nameinfo = loadConvertedClass(fname, false)</action>
+         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
          
          <rule>nameinfo != null
             <action>copy.putAnnotation("full-java-class", nameinfo.getQualifiedName())</action>
@@ -465,7 +468,7 @@
             
             <rule on="false">true
                <action>fname = getNoteString("found-in-source-file")</action>
-               <action>nameinfo = loadConvertedClass(fname, false)</action>
+               <action>nameinfo = loadConvertedClass(fname, false, this)</action>
                <rule>nameinfo != null
                   <rule>isNote("refid")
                      <!-- use the javaname at the refid, and not what we thing we should convert to -->
@@ -578,7 +581,7 @@
       <rule>this.type == prog.class_event
          <!-- annotate the event name -->
          <action>fname = getNoteString("found-in-source-file")</action>
-         <action>nameinfo = loadConvertedClass(fname, false)</action>
+         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
          <action>refid = getNoteLong("refid")</action>
          
          <rule>refid == null
@@ -613,7 +616,7 @@
           (copy.parent.type == prog.object_invocation and evalLib("input_argument", copy.parent)))
             
          <action>fname = getNoteString("cls-container")</action>
-         <action>nameinfo = loadConvertedClass(fname, false)</action>
+         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
          <action>refid = getNoteLong("refid")</action>
          
          <rule>refid == null
@@ -872,7 +875,7 @@
             !(isNote("cls-property") or getNoteBoolean("cls-property"))
             
          <action>fname = getNoteString("found-in-source-file")</action>
-         <action>nameinfo = loadConvertedClass(fname, false)</action>
+         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
          
          <!-- member vars -->
          <rule>!isNote("refid") and (!isNote("cls-property") or !getNoteBoolean("cls-property"))

=== modified file 'rules/convert/literals.rules'
--- rules/convert/literals.rules	2021-11-02 22:08:37 +0000
+++ rules/convert/literals.rules	2022-02-11 15:26:27 +0000
@@ -144,6 +144,7 @@
 **     CA  20210818          Emit 'instantiateUnknownMemptr' in cases when an unknown argument needs to be
 **                           passed for a memptr parameter.
 **     HC  20211001          Implementation of i18n support.
+**     ME  20211022          Handle conversion/wrapping for literals when data type is BaseDataType (POLY)
 */
  -->
 
@@ -396,7 +397,7 @@
                <rule>type == prog.string 
                   <!-- if set, get the class from the classname annotation -->
                   <action>classname = getNoteString("classname")</action>
-                  <rule>classname == null
+                  <rule>classname == null or classname.equals("Object")
                      <action>classname = "character"</action>
                   </rule>
                </rule>
@@ -425,6 +426,8 @@
             <rule>classname != "date"        and
                   classname != "datetime"    and
                   classname != "datetimetz"  and
+                  !classname.equals("BaseDataType") and
+                  !classname.equals("Object") and
                   type != prog.unknown_val
                <!-- insert an intermediate constructor node -->
                <action>

=== modified file 'src/com/goldencode/ast/AnnotatedAst.java'
--- src/com/goldencode/ast/AnnotatedAst.java	2021-03-22 09:22:18 +0000
+++ src/com/goldencode/ast/AnnotatedAst.java	2021-10-28 07:59:30 +0000
@@ -218,6 +218,7 @@
 ** 088 CA  20200615          Fixed iterator() when starting from a root with a single child.
 ** 089 CA  20201015          Replaced java.util.Stack with a non-synchronized custom implementation.
 ** 090 IAS 20210321          Added getImmediateChildren(int type) method 
+**     ME  20211025          Avoid NPE on toStringVerbose if text is null.
 */
 
 /*
@@ -3563,7 +3564,10 @@
     */
    public String toStringVerbose()
    {
-      StringBuilder sb = new StringBuilder(getText());
+      StringBuilder sb = new StringBuilder();
+      
+      if (getText() != null)
+         sb.append(getText());
       
       // append the token type as a name
       sb.append(" [").append(getSymbolicTokenType()).append("] ");

=== modified file 'src/com/goldencode/p2j/convert/ExpressionConversionWorker.java'
--- src/com/goldencode/p2j/convert/ExpressionConversionWorker.java	2022-02-07 16:05:16 +0000
+++ src/com/goldencode/p2j/convert/ExpressionConversionWorker.java	2022-02-11 15:26:27 +0000
@@ -222,6 +222,7 @@
 **     HC  20210401          Made isNumericType and isDateType part of the library.
 **     GES 20210610          Added KW_WID_HAND.
 **     HC  20211001          Implementation of i18n support.
+**     ME  20211028          Added the POLY 'virtual' data type.
 **     AL2 20211104          DB_REF_NON_STATIC generates case insensitive values.
 **     CA  20211214          The AST manager plugin must be context-local, for runtime conversion, as the 
 **                           InMemoryRegistryPlugin is not thread-safe.
@@ -1969,21 +1970,18 @@
                case KW_RET_VAL:
                   jcls = "BaseDataType";
                   break;
-                  
+               
                // unexpected *_POLY node, error out here
                default:
-                  if (oldtype == OO_METH_CLASS && source.getText().equalsIgnoreCase("invoke"))
-                  {
-                     String defClass = (String) source.getAnnotation("found-in-cls");
-                     if ("Progress.Lang.Class".equalsIgnoreCase(defClass) || 
-                         "progress.reflect.method".equalsIgnoreCase(defClass))
-                     {
-                        jcls = "BaseDataType";
-                     }
-                     break;
-                  }
-                  errmsg = "Unknown " + source.lookupTokenName(type) + 
-                           " with oldtype of " + source.lookupTokenName(oldtype);
+                  if (type == OO_METH_POLY) 
+                  {
+                     jcls = "BaseDataType";
+                  }
+                  else 
+                  {
+                     errmsg = "Unknown " + source.lookupTokenName(type) + 
+                              " with oldtype of " + source.lookupTokenName(oldtype);
+                  }
             }
             break;
          
@@ -2618,6 +2616,15 @@
          case KW_MEMPTR:
             jcls  = "memptr";
             break;
+         
+         case VAR_POLY:
+         case FUNC_POLY:
+         case ATTR_POLY:
+         case METH_POLY:
+         case OO_METH_POLY:
+         case KW_POLY:
+            jcls  = "Object";
+            break;
             
          case METH_VOID:
          case OO_METH_VOID:

=== modified file 'src/com/goldencode/p2j/oo/core/Assert.java'
--- src/com/goldencode/p2j/oo/core/Assert.java	2021-09-16 09:12:50 +0000
+++ src/com/goldencode/p2j/oo/core/Assert.java	2021-10-13 13:26:10 +0000
@@ -14,6 +14,7 @@
 ** 004 CA  20191024 Added method support levels and updated the class support level.
 ** 005 ME  20201023 Added implementation for isType, notType.
 **     ME  20210916 Delegate to AssertObject as needed.
+**     ME  20210930 Remove use of Apache StringUtils.
 */
 
 /*
@@ -84,8 +85,6 @@
 import static com.goldencode.p2j.util.TextOps.*;
 import static com.goldencode.p2j.util.ErrorManager.silent;
 
-import org.apache.commons.lang3.*;
-
 /**
  * Business logic (converted to Java from the 4GL source code in
  * OpenEdge/Core/Assert.cls).
@@ -567,7 +566,7 @@
       internalProcedure(Assert.class, "IsEmpty", new Block((Body) () -> {
          notNull(_p1, _p2);
          
-         if (!StringUtils.isEmpty(_p1.getValue()))
+         if (!TextOps.isEmpty(_p1))
             returnError(ObjectOps.newInstance(AssertionFailedError.class, "II",
                      substitute("&1 must be empty", _p2), 0));
       }));
@@ -1764,7 +1763,7 @@
    public static void notEmpty(final longchar _p1, final character _p2)
    {
       internalProcedure(Assert.class, "NotEmpty", new Block((Body) () -> {
-         if (!_p1.isUnknown() && StringUtils.isEmpty(_p1.getValue()))
+         if (!_p1.isUnknown() && TextOps.isEmpty(_p1))
             returnError(ObjectOps.newInstance(AssertionFailedError.class, "II",
                      substitute("&1 cannot be empty", _p2), 0));
       }));
@@ -1783,7 +1782,7 @@
       character p2 = TypeFactory.initInput(_p2);
       
       internalProcedure(Assert.class, "NotEmpty", new Block((Body) () -> {
-         if (StringUtils.isEmpty(p1.getValue()))
+         if (TextOps.isEmpty(p1))
             returnError(ObjectOps.newInstance(AssertionFailedError.class, "II",
                      substitute("&1 cannot be empty", p2), 0));
       }));

=== modified file 'src/com/goldencode/p2j/oo/core/ByteBucket.java'
--- src/com/goldencode/p2j/oo/core/ByteBucket.java	2021-09-17 15:14:10 +0000
+++ src/com/goldencode/p2j/oo/core/ByteBucket.java	2022-02-11 15:26:27 +0000
@@ -120,7 +120,7 @@
     */
    public void __core_ByteBucket_execute__()
    {
-      externalProcedure(ByteBucket.this, new Block((Body) () -> {
+      externalProcedure(ByteBucket.class, ByteBucket.this, new Block((Body) () -> {
          onBlockLevel(Condition.ERROR, Action.THROW);
          {
          }
@@ -168,7 +168,7 @@
    {
       int64 var = TypeFactory.initInput(_var);
 
-      internalProcedure(this, "Position", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "Position", new Block((Body) () -> {
          position.assign(var);
       }));
    }
@@ -213,7 +213,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public void __core_ByteBucket_constructor__()
    {
-      internalProcedure(this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
          __core_ByteBucket_constructor__(new int64(0));
       }));
    }
@@ -231,7 +231,7 @@
    {
       int64 defaultCapacity = TypeFactory.initInput(_defaultCapacity);
       
-      internalProcedure(this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
          __lang_BaseObject_constructor__();
 
          // just throw a 'matching' error for now until implementation is using the new MemoryOutputStream
@@ -272,7 +272,7 @@
 
       integer initialSize = TypeFactory.initInput(_initialSize);
 
-      internalProcedure(this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
          __core_ByteBucket_constructor__();
 
          Assert.isPositive(initialSize, new character("Initial size"));
@@ -305,7 +305,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public void __core_ByteBucket_destructor__()
    {
-      internalProcedure(this, "__core_ByteBucket_destructor__", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "__core_ByteBucket_destructor__", new Block((Body) () -> {
          destroy();
       }));
    }
@@ -318,7 +318,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public void clear_()
    {
-      internalProcedure(this, "Clear", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "Clear", new Block((Body) () -> {
          this.position.assign(1);
          this.size.assign(0);
       }));
@@ -332,7 +332,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public void debug()
    {
-      internalProcedure(this, "Debug", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "Debug", new Block((Body) () -> {
 
          String debugPath = String.format("%sbytebucket-memptr-%d.bin", 
                   EnvironmentOps.getTempDirectory().getValue(), 
@@ -359,7 +359,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public void destroy()
    {
-      internalProcedure(this, "Destroy", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "Destroy", new Block((Body) () -> {
          this.position.assign(1);
          this.size.setUnknown();
 
@@ -472,7 +472,7 @@
       int64 pos = TypeFactory.initInput(_pos);
       int64 size = TypeFactory.initInput(_size);
       object<? extends Memptr> ret = TypeFactory.object(Memptr.class);
-
+      
       return function(this, "GetBytes", object.class, new Block((Body) () -> {
          if (getSize().longValue() == 0 || size.getValue() == 0)
          {
@@ -481,8 +481,8 @@
          else
          {
             memptr ptr = TypeFactory.memptr();
-   
-            try
+
+            try 
             {
                ptr.setLength(size);
    
@@ -492,11 +492,10 @@
             }
             finally
             {
-               if (ptr.lengthOf() > 0L)
-                  ptr.setLength(0L);
+               ptr.setLength(0L);
             }
          }
-         
+
          returnNormal(ret);
 
       }));
@@ -665,8 +664,7 @@
          }
          finally
          {
-            if (ptr.lengthOf() > 0L)
-               ptr.setLength(0L);
+            ptr.setLength(0L);
          }
       }));
    }
@@ -679,7 +677,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public void initialize()
    {
-      internalProcedure(this, "Initialize", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "Initialize", new Block((Body) () -> {
          clear_();
       }));
    }
@@ -761,7 +759,7 @@
    {
       object<? extends ByteBucket> data = TypeFactory.initInput(_data);
 
-      internalProcedure(this, "PutBytes", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "PutBytes", new Block((Body) () -> {
          Assert.notNull(data, new character("Input data"));
 
          ByteBucket bbucket = data.ref();
@@ -797,7 +795,7 @@
       int64 ptr = TypeFactory.initInput(_ptr);
       int64 size = TypeFactory.initInput(_size);
 
-      internalProcedure(this, "PutBytes", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "PutBytes", new Block((Body) () -> {
 
          if (!size.isUnknown() && size.longValue() == 0L)
             return;
@@ -834,7 +832,7 @@
    {
       memptr ptr = TypeFactory.initInput(_ptr);
 
-      internalProcedure(this, "PutBytes", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "PutBytes", new Block((Body) () -> {
          writeBytes(ptr);
       }));
    }
@@ -851,7 +849,7 @@
    {
       object<? extends Memptr> mptr = TypeFactory.initInput(_mptr);
 
-      internalProcedure(this, "PutBytes", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "PutBytes", new Block((Body) () -> {
          Assert.notNull(_mptr, new character("Data"));
 
          putBytes(mptr.ref().getPointerValue(), mptr.ref().getSize());
@@ -870,7 +868,7 @@
    {
       longchar data = TypeFactory.initInput(_data);
 
-      internalProcedure(this, "PutString", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "PutString", new Block((Body) () -> {
          putString(data, new longchar("UTF-8"));
       }));
    }
@@ -907,7 +905,7 @@
       longchar data = TypeFactory.initInput(_data);
       character targetCP = TypeFactory.initInput(_targetCP);
 
-      internalProcedure(this, "PutString", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "PutString", new Block((Body) () -> {
          if (TextOps.isEmpty(data))
             return;
 
@@ -941,7 +939,7 @@
    {
       object<? extends LegacyString> data = TypeFactory.initInput(_data);
 
-      internalProcedure(this, "PutString", new Block((Body) () -> {
+      internalProcedure(ByteBucket.class, this, "PutString", new Block((Body) () -> {
          Assert.notNull(data, new character("String data"));
          
          putString(data.ref().getValue(), new longchar(data.ref().getEncoding()));
@@ -988,10 +986,12 @@
    {
       Assert.isPositive(p, new character("Start position"));
 
-      if (CompareOps._isGreaterThan(p, this.getSize())) {
-         ErrorManager.recordOrThrowError(4391,  "Unable to evaluate expression with UNKNOWN value in argument");
+      if (CompareOps._isGreaterThan(p, this.getSize()))
+      {
+         ErrorManager.recordOrThrowError(4391,
+                  "Unable to evaluate expression with UNKNOWN value in argument");
       }
-      
+
       long pos = p.longValue();
       long bytesLeft = data.lengthOf();
       int putAt = 0;
@@ -999,7 +999,6 @@
       int offset = (int) ((pos - 1) % MAX_BYTES_PER_ROW);
       int endBucket = (int) ((size.longValue()) / MAX_BYTES_PER_ROW);
       int endOffset = (int) ((size.longValue()) % MAX_BYTES_PER_ROW);
-      
 
       for (int i = nbucket; i <= endBucket; i++)
       {
@@ -1008,13 +1007,12 @@
 
          if (numBytes > 0)
          {
-            data.write(true, Arrays.copyOfRange(bucket, offset, offset + numBytes), putAt,
-                     false);
+            data.write(true, Arrays.copyOfRange(bucket, offset, offset + numBytes), putAt, false);
 
             offset = 0;
             putAt += numBytes;
             bytesLeft -= numBytes;
-            
+
             if (bytesLeft == 0)
                return;
          }

=== modified file 'src/com/goldencode/p2j/oo/core/LegacyString.java'
--- src/com/goldencode/p2j/oo/core/LegacyString.java	2021-09-16 13:13:54 +0000
+++ src/com/goldencode/p2j/oo/core/LegacyString.java	2021-10-13 13:32:21 +0000
@@ -15,6 +15,7 @@
 **                  signature.
 ** 007 ME  20210520 Set hashCode to return the actual string hashCode.
 **     ME  20210902 Return default hashCode if unknown, fix empty static method and isNullOrEmpty to use trim.
+**     ME  20210929 Fix return value on join/split methods.
 */
 
 /*
@@ -403,28 +404,23 @@
       object<? extends com.goldencode.p2j.oo.core.collections.Array> p1 = TypeFactory
                .initInput(_p1);
       character p2 = TypeFactory.initInput(_p2);
+      object<? extends LegacyString> poRet = TypeFactory.object(LegacyString.class);
 
-      return function(LegacyString.class, "Join", object.class, new Block((Body) () ->
-      {
+      return function(LegacyString.class, "Join", object.class, new Block((Body) () -> {
          object<? extends LegacyClass> clsString = ObjectOps.getLegacyClass(LegacyString.class);
-         // remove the assert to fix the OE BUG
-         Assert.isType(p1, clsString);
 
-         if (p2.isUnknown() || p1.isUnknown())
-         {
-            returnNormal(new longchar());
-         }
-         else
+         if (!p2.isUnknown() && !p1.isUnknown())
          {
             List<String> entries = new ArrayList<String>();
+            boolean hasUnknown = false;
 
             for (int i = 1; i <= p1.ref().getSize().intValue(); i++)
             {
                object<? extends _BaseObject_> c = p1.ref().getValue(new integer(i));
                if (c.isUnknown())
                {
-                  returnNormal(new longchar());
-                  return;
+                  hasUnknown = true;
+                  break;
                }
 
                Assert.isType(c, clsString);
@@ -432,11 +428,15 @@
                entries.add(ObjectOps.cast(c, LegacyString.class).ref().getValue().getValue());
             }
 
-            String join = entries.stream().collect(Collectors.joining(p2.getValue()));
-
-            returnNormal(ObjectOps.newInstance(LegacyString.class, "I", join));
+            if (!hasUnknown) {
+               String join = entries.stream().collect(Collectors.joining(p2.getValue()));
+   
+               poRet.assign(ObjectOps.newInstance(LegacyString.class, "I", join));
+            }
          }
 
+         returnNormal(poRet);
+
       }));
    }
 
@@ -485,30 +485,36 @@
    {
       object<? extends com.goldencode.p2j.oo.core.LegacyString>[] p1 = TypeFactory.initInput(_p1);
       character p2 = TypeFactory.initInput(_p2);
-
+      object<? extends LegacyString> poRet = TypeFactory.object(LegacyString.class);
+      
       return function(LegacyString.class, "Join", object.class, new Block((Body) () -> {
          // indeterminate array or null delimiter 
-         if (p1.length == 0 || p2.isUnknown())
-         {
-            returnNormal(ObjectOps.newInstance(LegacyString.class, "I", new longchar()));
-         }
-         else
-         {
+         if (p1.length > 0 && !p2.isUnknown())
+         {
+            boolean hasUnknown = false;
+            
             for (object<? extends com.goldencode.p2j.oo.core.LegacyString> s : p1)
             {
                // OE does not check for valid objects in array (will throw error)
                // if any of the strings has a null value the result is always null
                if (!s.isUnknown() && s.ref().getValue().isUnknown())
                {
-                  returnNormal(ObjectOps.newInstance(LegacyString.class, "I", new longchar()));
-                  return;
+                  hasUnknown = true;
+                  break;
                }
             }
 
-            returnNormal(ObjectOps.newInstance(LegacyString.class, "I",
-                     Arrays.stream(p1).map(s -> s.ref().getValue().getValue())
+            poRet.assign(ObjectOps.newInstance(LegacyString.class, "I",
+                        hasUnknown ? new character() : Arrays.stream(p1).map(s -> s.ref().getValue().getValue())
                               .collect(Collectors.joining(p2.getValue()))));
          }
+         else 
+         {
+            poRet.assign(ObjectOps.newInstance(LegacyString.class, "I", new character("")));
+         }
+            
+         
+         returnNormal(poRet);
       }));
    }
 
@@ -628,33 +634,35 @@
    {
       object<? extends com.goldencode.p2j.oo.core.LegacyString> p1 = TypeFactory.initInput(_p1);
       character p2 = TypeFactory.initInput(_p2);
+      object<? extends com.goldencode.p2j.oo.core.collections.Array> poRet = TypeFactory
+               .object(com.goldencode.p2j.oo.core.collections.Array.class);
 
-      return function(LegacyString.class, "Split", object.class, new Block((Body) () ->
-      {
+      return function(LegacyString.class, "Split", object.class, new Block((Body) () -> {
 
          if (!p1.isUnknown() && (p2.isUnknown() || p1.ref().getValue().isUnknown()))
          {
             // num-entries is unknown, this will throw assert error
-            returnNormal(ObjectOps.newInstance(com.goldencode.p2j.oo.core.collections.Array.class,
+            poRet.assign(ObjectOps.newInstance(com.goldencode.p2j.oo.core.collections.Array.class,
                      "I", new integer()));
          }
          else
          {
             // 4GL does not test the string object, 3135 system error will be thrown if null
             String[] entries = TextOps.entries(p1.ref().getValue().getValue(), p2.getValue());
-            object<? extends com.goldencode.p2j.oo.core.collections.Array> outputArray = ObjectOps
-                     .newInstance(com.goldencode.p2j.oo.core.collections.Array.class, "I",
-                              entries.length);
+            poRet.assign(ObjectOps.newInstance(com.goldencode.p2j.oo.core.collections.Array.class,
+                     "I", entries.length));
 
             for (int i = 0; i < entries.length; i++)
             {
-               outputArray.ref().setValue(ObjectOps
-                        .newInstance(com.goldencode.p2j.oo.core.LegacyString.class, "I", entries[i]), new integer(i + 1));
+               poRet.ref()
+                        .setValue(ObjectOps.newInstance(
+                                 com.goldencode.p2j.oo.core.LegacyString.class, "I", entries[i]),
+                                 new integer(i + 1));
             }
-            
-            returnNormal(outputArray);
+
          }
 
+         returnNormal(poRet);
       }));
    }
 

=== modified file 'src/com/goldencode/p2j/oo/core/WidgetHandle.java'
--- src/com/goldencode/p2j/oo/core/WidgetHandle.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/core/WidgetHandle.java	2021-10-01 10:52:07 +0000
@@ -10,6 +10,7 @@
 ** 003 CA  20191024 Added method support levels and updated the class support level.
 ** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
+**     ME  20211001 Fix toString method, returns unknown if invalid handle.
 */
 
 /*
@@ -236,7 +237,7 @@
    {
       return function(this, "ToString", character.class, new Block((Body) () ->
       {
-         returnNormal(this.value.toStringMessage());
+         returnNormal(character.valueOf(this.value));
       }));
    }
 }

=== modified file 'src/com/goldencode/p2j/oo/core/collections/AbstractTtcollection.java'
--- src/com/goldencode/p2j/oo/core/collections/AbstractTtcollection.java	2021-06-09 14:35:48 +0000
+++ src/com/goldencode/p2j/oo/core/collections/AbstractTtcollection.java	2021-09-28 08:33:36 +0000
@@ -13,6 +13,7 @@
 **                  signature.
 **     CA  20210609 Updated INPUT/INPUT-OUTPUT parameters to the new approach, where they are explicitly 
 **                  initialized at the method's execution, and not at the caller's arguments.
+**     ME  20210928 Fix return value on clone method, defined out of the function block.
 */
 
 /*
@@ -459,8 +460,10 @@
    @Override
    public object<? extends com.goldencode.p2j.oo.lang._BaseObject_> clone()
    {
+      object<? extends Icollection> clone = TypeFactory.object(Icollection.class);
+      
       return function(this, "Clone", object.class, new Block((Body) () -> {
-         object<? extends AbstractTtcollection> clone = ObjectOps.newInstance(getClass());
+         clone.assign(ObjectOps.newInstance(getClass()));
          cloneElements(clone);
          returnNormal(clone);
       }));

=== modified file 'src/com/goldencode/p2j/oo/core/collections/Array.java'
--- src/com/goldencode/p2j/oo/core/collections/Array.java	2021-09-16 13:11:28 +0000
+++ src/com/goldencode/p2j/oo/core/collections/Array.java	2021-10-13 13:43:50 +0000
@@ -14,7 +14,9 @@
 **         20210113 Renamed clear() to clear_(), to follow NameConverter's rules.
 ** 006 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
-**     ME  20210916 Fix wrong method call on set (increment instead of decrement)
+**     ME  20210916 Fix wrong method call on set (increment instead of decrement). Clean-up resize
+**                  and fix 'retainAll' method.
+**     ME  20210929 Fix clone return value.
 */
 
 /*
@@ -197,7 +199,48 @@
    {
       integer newSize = TypeFactory.initInput(_newSize);
       internalProcedure(this, "Size", new Block((Body) () -> {
-         this.setArraySize(newSize.isUnknown() ? 0 : newSize.intValue());
+         if (newSize.isUnknown())
+         {
+            if (!discardOnShrink.booleanValue())
+            {
+               undoThrowTopLevel(ObjectOps.newInstance(ResizeError.class, "II",
+                        new character("Array"), new character("smaller")));
+            }
+
+            value = ArrayAssigner.resize(value, newSize);
+         }
+         else
+         {
+            integer initSize = getSize();
+
+            if (!CompareOps._isEqual(initSize, newSize))
+            {
+               if (initSize.isUnknown())
+               {
+                  value = ArrayAssigner.resize(value, newSize);
+               }
+               else
+               {
+                  if (CompareOps._isLessThan(newSize, initSize) && !discardOnShrink.booleanValue())
+                     undoThrowTopLevel(ObjectOps.newInstance(ResizeError.class, "II",
+                              new character("Array"), new character("smaller")));
+                  
+                  object<? extends com.goldencode.p2j.oo.lang._BaseObject_>[] tmpValue = TypeFactory
+                           .objectExtent(initSize.intValue(), BaseObject.class);
+
+                  tmpValue = (object<? extends _BaseObject_>[]) ArrayAssigner.assignMulti(tmpValue,
+                           value);
+
+                  value = ArrayAssigner.resize(value, new integer());
+                  value = ArrayAssigner.resize(value, newSize);
+
+                  for (int i = 0; i < initSize.intValue(); i++)
+                  {
+                     value[i] = tmpValue[i];
+                  }
+               }
+            }
+         }
       }));
    }
 
@@ -292,17 +335,17 @@
 
       return function(this, "AddArray", logical.class, new Block((Body) () -> {
          // OE bug, no check if extent is unknown - size is set to unknown
-
-         setArraySize(
-                  p1.length == 0 || getSize().isUnknown() ? 0 : p1.length + getSize().intValue());
-
-         for (int i = 1; i <= p1.length; i++)
+         if (p1.length > 0) 
          {
-            // incrementing an unknown is always unknown
-            setValue(p1[i - 1], getSize().isUnknown() ? new integer()
-                     : new integer(getSize().intValue() + i));
+            integer size = getSize();
+            
+            setSize(new integer(p1.length + size.getValue()));
+   
+            for (int i = 1; i <= p1.length; i++)
+            {
+               setValue(p1[i - 1], new integer(size.getValue() + i));
+            }
          }
-
          returnNormal(true);
       }));
    }
@@ -312,7 +355,7 @@
    public void clear_()
    {
       internalProcedure(this, "Clear", new Block((Body) () -> {
-         setArraySize(0);
+         setSize(new integer());
       }));
    }
 
@@ -320,8 +363,10 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public object<? extends com.goldencode.p2j.oo.lang._BaseObject_> clone()
    {
+      object<? extends Icollection> clone = TypeFactory.object(Icollection.class);
+      
       return function(this, "Clone", object.class, new Block((Body) () -> {
-         object<? extends Array> clone = ObjectOps.newInstance(getClass());
+         clone.assign(ObjectOps.newInstance(getClass()));
 
          cloneElements(clone);
 
@@ -445,13 +490,14 @@
 
          for (int i = 1; i <= value.length; i++)
          {
-            if (!value[i].ref().legacyEquals(p1).booleanValue())
+            object<? extends _BaseObject_> obj = ArrayAssigner.subscript(this.value, i);
+            if (obj.ref().legacyEquals(p1).booleanValue())
             {
                // decrement reference to object
-               ObjectOps.decrement(value[i].ref());
+               ObjectOps.decrement(obj.ref());
 
                // set it to invalid
-               value[i] = new object<>();
+               ArrayAssigner.assignSingle(this.value, i, new object<>());
                returnNormal(new logical(true));
             }
          }
@@ -472,7 +518,7 @@
       return function(this, "RemoveAll", logical.class, new Block((Body) () -> {
          boolean lAny = false;
 
-         object<? extends Iiterator> iterator = iterator();
+         object<? extends Iiterator> iterator = p1.ref().iterator();
 
          while (iterator.ref().hasNext().booleanValue())
          {
@@ -513,59 +559,13 @@
       }));
    }
 
-   private void setArraySize(final int newSize)
-   {
-      if (newSize == 0)
-      {
-         if (!discardOnShrink.booleanValue())
-         {
-            undoThrowTopLevel(ObjectOps.newInstance(ResizeError.class, "II",
-                     new character("Array"), new character("smaller")));
-         }
-
-         value = ArrayAssigner.resize(value, new integer());
-      }
-      else
-      {
-         integer initSize = getSize();
-
-         if (initSize.isUnknown() || newSize != initSize.intValue())
-         {
-            if (initSize.isUnknown())
-            {
-               value = ArrayAssigner.resize(value, newSize);
-            }
-            else
-            {
-               if (newSize < initSize.intValue() && !discardOnShrink.booleanValue())
-                  undoThrowTopLevel(ObjectOps.newInstance(ResizeError.class, "II",
-                           new character("Array"), new character("smaller")));
-               
-               object<? extends com.goldencode.p2j.oo.lang._BaseObject_>[] tmpValue = TypeFactory
-                        .objectExtent(initSize.intValue(), BaseObject.class);
-
-               tmpValue = (object<? extends _BaseObject_>[]) ArrayAssigner.assignMulti(tmpValue,
-                        value);
-
-               value = ArrayAssigner.resize(value, new integer());
-               value = ArrayAssigner.resize(value, newSize);
-
-               for (int i = 0; i < initSize.intValue(); i++)
-               {
-                  value[i] = tmpValue[i];
-               }
-            }
-         }
-      }
-   }
-
    @LegacySignature(type = Type.METHOD, name = "SetValue", parameters = {
             @LegacyParameter(name = "p1", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT") })
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public void setValue(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _p1)
    {
       internalProcedure(this, "SetValue", new Block((Body) () -> {
-         setValue(_p1, getSize().isUnknown() ? getSize() : new integer(getSize().intValue() + 1));
+         setValue(_p1, getSize().isUnknown() ? getSize() : new integer(MathOps.plus(getSize(), 1)));
       }));
    }
 
@@ -581,11 +581,11 @@
 
       internalProcedure(this, "SetValue", new Block((Body) () -> {
 
-         if (!p2.isUnknown() && !getSize().isUnknown() && p2.intValue() > getSize().intValue())
+         if (CompareOps._isGreaterThan(p2, getSize()))
          {
             if (autoExpand.booleanValue())
             {
-               setArraySize(p2.intValue() + (int) Math.round(getSize().intValue() * 0.5));
+               setSize(new integer(MathOps.plus(p2, MathOps.round(MathOps.multiply(getSize(), 0.5), 0))));
             }
             else
             {
@@ -596,13 +596,16 @@
          }
 
          // decrement reference to previous object if any
-         if (!value[p2.intValue() - 1].isUnknown())
-            ObjectOps.decrement(value[p2.intValue() - 1].ref());
+         object<? extends _BaseObject_> obj = ArrayAssigner.subscript(value, p2);
+         
+         if (!obj.isUnknown())
+            ObjectOps.decrement(obj.ref());
 
          ArrayAssigner.assignSingle(value, p2, p1);
 
          // increment reference to object
-         ObjectOps.increment(p1.ref());
+         if (!p1.isUnknown())
+            ObjectOps.increment(p1.ref());
       }));
    }
 

=== modified file 'src/com/goldencode/p2j/oo/core/collections/ArrayIterator.java'
--- src/com/goldencode/p2j/oo/core/collections/ArrayIterator.java	2021-02-23 07:39:32 +0000
+++ src/com/goldencode/p2j/oo/core/collections/ArrayIterator.java	2021-09-28 07:53:08 +0000
@@ -9,6 +9,7 @@
 ** 002 CA  20210113 Renamed Iiterator.next to Iiterator.next_, to follow NameConverter's rules.
 ** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
+** 004 ME  20210927 Use '4GL' compare to account for unknown values.
 */
 
 /*
@@ -173,7 +174,7 @@
    {
       return function(ArrayIterator.class, this, "HasNext", logical.class, new Block((Body) () ->
       {
-         returnNormal(currentExtent.intValue() < iteratedArray.ref().getSize().intValue());
+         returnNormal(CompareOps.lessThan(currentExtent, iteratedArray.ref().getSize()));
       }));
    }
 
@@ -183,7 +184,7 @@
    {
       return function(ArrayIterator.class, this, "Next", object.class, new Block((Body) () ->
       {
-         currentExtent.assign(currentExtent.intValue() + 1);
+         currentExtent.assign(MathOps.plus(currentExtent, 1));
          returnNormal(iteratedArray.ref().getValue(currentExtent));
       }));
    }

=== modified file 'src/com/goldencode/p2j/oo/core/collections/LegacyMap.java'
--- src/com/goldencode/p2j/oo/core/collections/LegacyMap.java	2021-09-10 06:50:38 +0000
+++ src/com/goldencode/p2j/oo/core/collections/LegacyMap.java	2022-02-11 15:26:27 +0000
@@ -14,6 +14,7 @@
 ** 004 ME  20210325 Increment/decrement object references (key/value) when added/removed.
 **     ME  20210521 Use a 'key' object with hashCode/equals overrides.
 **     ME  20210902 Do not decrement reference for input parameter on remove.
+**     ME  20210929 Fix return object on get/put/remove.
 */
 
 /*
@@ -314,15 +315,16 @@
    {
       object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poKey = TypeFactory
                .initInput(_poKey);
-
+      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poRet = TypeFactory.object(_BaseObject_.class);
+      
       return function(LegacyMap.class, this, "Get", object.class, new Block((Body) () ->
       {
          keyobject key = new keyobject(poKey);
          
          if (map.containsKey(key))
-            returnNormal(map.get(key));
+            poRet.assign(map.get(key));
 
-         returnNormal(new object());
+         returnNormal(poRet);
       }));
    }
 
@@ -338,26 +340,31 @@
                .initInput(_poKey);
       object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poValue = TypeFactory
                .initInput(_poValue);
-
+      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poRet = TypeFactory.object(_BaseObject_.class);
+      
       return function(LegacyMap.class, this, "Put", object.class, new Block((Body) () ->
       {
          if (poKey.ref().equals(this))
             undoThrow(AppError.newInstance(new character("A Map cannot have itself as key.")));
 
-         if (poValue._isValid())
+         if (!poValue.isUnknown())
          {
             ObjectOps.increment(poValue.ref());
          }
          
-         object obj = map.put(new keyobject(poKey), poValue);
-
-         if (obj == null) 
+         poRet.assign(map.put(new keyobject(poKey), poValue));
+         
+         if (!poRet.isUnknown()) 
+         {
+            ObjectOps.decrement(poRet.ref());
+         }
+         else 
          {
             ObjectOps.increment(poKey.ref());
             size++;
          }
          
-         returnNormal(obj != null ? obj : new object());
+         returnNormal(poRet);
       }));
    }
 
@@ -388,21 +395,27 @@
    {
       object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poKey = TypeFactory
                .initInput(_poKey);
-
+      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poRet = TypeFactory.object(_BaseObject_.class);
+      
       return function(LegacyMap.class, this, "Remove", object.class, new Block((Body) () ->
       {
          if (!poKey.isValid().booleanValue())
             returnNormal(new object());
 
-         object obj = map.remove(poKey);
-         
-         if (obj != null && obj._isValid())
-            ObjectOps.decrement(obj.ref());
-         
-         if (obj != null)
+         poRet.assign(map.remove(new keyobject(poKey)));
+         
+         if (!poRet.isUnknown())
+         {
+            ObjectOps.decrement(poRet.ref());
             size--;
+         	
+            if (!map.containsKey(poKey))
+            {
+               ObjectOps.decrement(poKey.ref());
+            }
+         }
          
-         returnNormal(obj != null ? obj : new object());
+         returnNormal(poRet);
       }));
    }
 

=== modified file 'src/com/goldencode/p2j/oo/io/FileInputStream.java'
--- src/com/goldencode/p2j/oo/io/FileInputStream.java	2021-06-09 14:35:48 +0000
+++ src/com/goldencode/p2j/oo/io/FileInputStream.java	2021-10-13 13:43:50 +0000
@@ -12,8 +12,9 @@
 **     ME   20210204 Complete implementation as of OE12.2.
 ** 005 CA   20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                   signature.
-**     CA  20210609 Updated INPUT/INPUT-OUTPUT parameters to the new approach, where they are explicitly 
-**                  initialized at the method's execution, and not at the caller's arguments.
+**     CA   20210609 Updated INPUT/INPUT-OUTPUT parameters to the new approach, where they are explicitly 
+**                   initialized at the method's execution, and not at the caller's arguments.
+**     ME   20211001 Do not attempt to open the stream in ctor, delay it till read/skip is used.
 */
 
 /*
@@ -132,21 +133,6 @@
          
          this.fileName.assign(filename);
          
-         try
-         {
-            sFileStream.assign(StreamFactory.openFileStream((filename).toStringMessage(), false, false));
-            sFileStream.setBinary();
-            sFileStream.setConvert(false);
-            
-            FileSystemOps.initFileInfo(fileName);
-            fileSize = FileSystemOps.fileInfoGetSize().longValue();
-            bytesLeft = fileSize;
-         }
-         catch (Exception e)
-         {
-            undoThrow(SysError.newInstance("Cannot find or open file %s, errno = 2", 11294, true, false));
-         } 
-         
       }));
    }
    
@@ -167,7 +153,9 @@
    {
       internalProcedure(FileInputStream.class, this, "Close", new Block((Body) () -> 
       {
-         sFileStream.closeIn();
+         if(sFileStream.isValid())
+            sFileStream.closeIn();
+         
          super.close();
       }));
    }
@@ -262,6 +250,8 @@
             undoThrow(SysError.newInstance("Invalid value specified for parameter 'length' of method or constructor 'Read'", 18193, false, true));
          }
          
+         _checkOpen();
+         
          long toRead = bytesLeft;
          
          if (bytesLeft > 0)
@@ -328,4 +318,24 @@
          undoThrow(SysError.newInstance("Cannot invoke Read method in 'Progress.IO.FileInputStream' because it is not implemented", 18192, false, false));
       }));
    }
+   
+   private void _checkOpen () {
+      if (!sFileStream.isValid()) 
+      {
+         try
+         {
+            sFileStream.assign(StreamFactory.openFileStream((fileName).toStringMessage(), false, false));
+            sFileStream.setBinary();
+            sFileStream.setConvert(false);
+            
+            FileSystemOps.initFileInfo(fileName);
+            fileSize = FileSystemOps.fileInfoGetSize().longValue();
+            bytesLeft = fileSize;
+         }
+         catch (Exception e)
+         {
+            undoThrow(SysError.newInstance("Cannot find or open file %s, errno = 2", 11294, true, false));
+         }
+      }
+   }
 }

=== modified file 'src/com/goldencode/p2j/oo/json/objectmodel/JsonObject.java'
--- src/com/goldencode/p2j/oo/json/objectmodel/JsonObject.java	2021-09-17 15:14:10 +0000
+++ src/com/goldencode/p2j/oo/json/objectmodel/JsonObject.java	2022-02-11 15:26:27 +0000
@@ -24,6 +24,7 @@
 **     CA  20210816 Fixed clone() - object references must be incremented.
 **     OM  20210825 getJsonDataTypeName() is static now.
 **     VVT 20210917 Javadoc fixed. 
+**     ME  20210929 Fix return value on clone method.
 */
 
 /*
@@ -513,9 +514,12 @@
    @Override
    public object<? extends com.goldencode.p2j.oo.lang._BaseObject_> clone()
    {
+      object<JsonObject> cloned = TypeFactory.object(JsonObject.class);
+      
       return function(this, "Clone", object.class, new Block((Body) () ->
       {
-         object<JsonObject> cloned = ObjectOps.newInstance(JsonObject.class);
+         cloned.assign(ObjectOps.newInstance(JsonObject.class));
+         
          for (Map.Entry<String, Object> prop : properties.entrySet())
          {
             Object val = prop.getValue();

=== modified file 'src/com/goldencode/p2j/oo/json/objectmodel/ObjectModelParser.java'
--- src/com/goldencode/p2j/oo/json/objectmodel/ObjectModelParser.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/json/objectmodel/ObjectModelParser.java	2022-02-11 15:26:27 +0000
@@ -14,6 +14,7 @@
 ** 007 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
 **     OM  20210329 FIX-CODEPAGE is emitted as static method call to accomodate dereferenciation cases.
 **     CA  20210709 JSON parse must use a pristine byte stream and use the reader to decode it.
+**     ME  20210929 Fix return value on parse methods.
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
 **                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
 **                  be tracked.
@@ -254,7 +255,6 @@
          }
          
          // empty string does not throw as for character/longchar so parse the string directly
-         
          try
          {
             res.assign(JsonBackend.instance().parse(source.getString(1).toStringMessage()));

=== modified file 'src/com/goldencode/p2j/oo/lang/LegacyClass.java'
--- src/com/goldencode/p2j/oo/lang/LegacyClass.java	2021-02-26 00:57:16 +0000
+++ src/com/goldencode/p2j/oo/lang/LegacyClass.java	2021-10-28 07:59:30 +0000
@@ -22,6 +22,7 @@
 **     GES 20200605 Fixed isValidEnum() processing.
 ** 009 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
 **     OM  20210225 Dropped duplicated error code.
+**     ME  20211028 Use 'POLY' data type for return/parameter on invoke/getPropertyValue/setPropertyValue.
 */
 
 /*
@@ -143,7 +144,7 @@
     * 
     * @return   See above.
     */
-   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "propName", type = "CHARACTER", mode = "INPUT")
    })
@@ -165,13 +166,13 @@
     * 
     * @return   See above.
     */
-   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "propName", type = "CHARACTER", mode = "INPUT"),
-      @LegacyParameter(name = "idx", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
+      @LegacyParameter(name = "idx", type = "BDT", mode = "INPUT")
    })
    @LegacyResourceSupport(supportLvl = CVT_LVL_PARTIAL|RT_LVL_STUB)
-   public Object getPropertyValue(character propName, object<? extends BaseObject> idx)
+   public Object getPropertyValue(character propName, Object idx)
    {
       // TODO:
       return new unknown();
@@ -187,7 +188,7 @@
     * 
     * @return   See above.
     */
-   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "instance", type = "OBJECT", qualified = "Progress.Lang.Object", mode = "INPUT"),
       @LegacyParameter(name = "propName", type = "CHARACTER", mode = "INPUT"),
@@ -212,21 +213,21 @@
     * 
     * @return   See above.
     */
-   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "instance", type = "OBJECT", qualified = "Progress.Lang.Object", mode = "INPUT"),
       @LegacyParameter(name = "propName", type = "CHARACTER", mode = "INPUT"),
-      @LegacyParameter(name = "idx", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
+      @LegacyParameter(name = "idx", type = "BDT", mode = "INPUT")
    })
    @LegacyResourceSupport(supportLvl = CVT_LVL_PARTIAL|RT_LVL_STUB)
    public Object getPropertyValue(object<? extends _BaseObject_> instance, 
                                   character propName, 
-                                  object<? extends BaseObject> idx)
+                                  Object idx)
    {
       // TODO:
       return new unknown();
    }
-
+   
    /**
     * Resolve the legacy class from the given name.
     * 
@@ -743,7 +744,7 @@
     *            
     * @return    Any returned value, or unknown if the method is void.
     */
-   @LegacySignature(type = Type.METHOD, name = "invoke", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "invoke", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "method", type = "CHARACTER", mode = "INPUT")
    })
@@ -815,7 +816,7 @@
     *            
     * @return    Any returned value, or unknown if the method is void.
     */
-   @LegacySignature(type = Type.METHOD, name = "invoke", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "invoke", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "ref",    type = "OBJECT", mode = "INPUT", qualified = "Progress.Lang.Object"),
       @LegacyParameter(name = "parms",  type = "OBJECT", mode = "INPUT", qualified = "Progress.Lang.ParameterList")
@@ -846,7 +847,7 @@
     *            
     * @return    Any returned value, or unknown if the method is void.
     */
-   @LegacySignature(type = Type.METHOD, name = "invoke", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "invoke", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "ref",    type = "OBJECT",    mode = "INPUT", qualified = "Progress.Lang.Object"),
       @LegacyParameter(name = "method", type = "CHARACTER", mode = "INPUT"),
@@ -869,7 +870,7 @@
     *            
     * @return    Any returned value, or unknown if the method is void.
     */
-   @LegacySignature(type = Type.METHOD, name = "invoke", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "invoke", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "ref",    type = "OBJECT",    mode = "INPUT", qualified = "Progress.Lang.Object"),
       @LegacyParameter(name = "method", type = "CHARACTER", mode = "INPUT"),
@@ -1272,60 +1273,55 @@
    @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
    {
       @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
-      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
-   })
-   public void setPropertyValue(final character _pname, final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _value)
-   {
-      character pname = TypeFactory.initInput(_pname);
-      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> value = TypeFactory.initInput(_value);
-      
-      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
-   }
-
-   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
-   {
-      @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
-      @LegacyParameter(name = "index", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
-      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
-   })
-   public void setPropertyValue(final character _pname, final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _index, final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _value)
-   {
-      character pname = TypeFactory.initInput(_pname);
-      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> index = TypeFactory.initInput(_index);
-      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> value = TypeFactory.initInput(_value);
-      
-      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
-   }
-
-   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
-   {
-      @LegacyParameter(name = "obj-ref", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
-      @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
-      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
-   })
-   public void setPropertyValue(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _objRef, final character _pname, final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _value)
-   {
-      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> objRef = TypeFactory.initInput(_objRef);
-      character pname = TypeFactory.initInput(_pname);
-      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> value = TypeFactory.initInput(_value);
-      
-      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
-   }
-
-   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
-   {
-      @LegacyParameter(name = "obj-ref", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
-      @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
-      @LegacyParameter(name = "index", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
-      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
-   })
-   public void setPropertyValue(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _objRef, final character _pname, final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _index, final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _value)
-   {
-      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> objRef = TypeFactory.initInput(_objRef);
-      character pname = TypeFactory.initInput(_pname);
-      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> index = TypeFactory.initInput(_index);
-      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> value = TypeFactory.initInput(_value);
-      
+      @LegacyParameter(name = "value", type = "BDT", mode = "INPUT")
+   })
+   public void setPropertyValue(final character _pname, final Object _value)
+   {
+      character pname = TypeFactory.initInput(_pname);
+      
+      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
+   }
+
+   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = {
+            @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
+            @LegacyParameter(name = "index", type = "BDT", mode = "INPUT"),
+            @LegacyParameter(name = "value", type = "BDT", mode = "INPUT") })
+   public void setPropertyValue(final character _pname, final Object _index,
+            final Object _value)
+   {
+      character pname = TypeFactory.initInput(_pname);
+
+      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
+   }
+   
+   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
+   {
+      @LegacyParameter(name = "obj-ref", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
+      @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
+      @LegacyParameter(name = "value", type = "BDT", mode = "INPUT")
+   })
+   public void setPropertyValue(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _objRef, final character _pname, final Object _value)
+   {
+      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> objRef = TypeFactory.initInput(_objRef);
+      character pname = TypeFactory.initInput(_pname);
+      
+      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
+   }
+
+   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = {
+            @LegacyParameter(name = "obj-ref", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
+            @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
+            @LegacyParameter(name = "index", type = "BDT", mode = "INPUT"),
+            @LegacyParameter(name = "value", type = "BDT", mode = "INPUT") })
+   public void setPropertyValue(
+            final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _objRef,
+            final character _pname, final Object _index,
+            final Object _value)
+   {
+      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> objRef = TypeFactory
+               .initInput(_objRef);
+      character pname = TypeFactory.initInput(_pname);
+
       internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
    }
 }

=== modified file 'src/com/goldencode/p2j/oo/net/MediaLinkEntity.java'
--- src/com/goldencode/p2j/oo/net/MediaLinkEntity.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/net/MediaLinkEntity.java	2021-10-13 13:43:50 +0000
@@ -10,6 +10,7 @@
 ** 
 ** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
+**     ME  20210929 Fix return object on deserialize, use enum literals in substitute.
 */
 
 /*
@@ -287,6 +288,7 @@
    {
       longchar pcMle = TypeFactory.initInput(_pcMle);
       object<? extends com.goldencode.p2j.oo.core.SerializationFormatEnum> poSerializedAs = TypeFactory.initInput(_poSerializedAs);
+      object<MediaLinkEntity> mle = TypeFactory.object(MediaLinkEntity.class);
       
       return function(MediaLinkEntity.class, "Deserialize", object.class, new Block((Body) () -> 
       {
@@ -298,11 +300,11 @@
          {
             undoThrow(AppError.newInstance(
                      TextOps.substitute("Unsupported MLE serialization type &1",
-                              poSerializedAs),
+                              poSerializedAs.ref().toLegacyString()),
                      new integer(0)));
          }
          
-         object<MediaLinkEntity> mle = ObjectOps.newInstance(MediaLinkEntity.class);
+         mle.assign(ObjectOps.newInstance(MediaLinkEntity.class));
          
          object<ObjectModelParser> parser = ObjectOps.newInstance(ObjectModelParser.class);
          object<JsonObject> jsonObj = ObjectOps.cast(parser.ref().parse(pcMle), JsonObject.class);
@@ -356,7 +358,7 @@
                   {
                      undoThrow(AppError.newInstance(
                               TextOps.substitute("Unsupported MLE serialization type &1",
-                                       poSerializedAs),
+                                       poSerializedAs.ref().toLegacyString()),
                               new integer(0)));
                   }
 

=== modified file 'src/com/goldencode/p2j/oo/net/MessagePart.java'
--- src/com/goldencode/p2j/oo/net/MessagePart.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/MessagePart.java	2022-02-11 15:26:27 +0000
@@ -12,6 +12,7 @@
 **         20201125 Set header value 'fluent', use substitute for toString. 
 ** 005 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
 **     OM  20210917 Code maintenance.
+**     ME  20210929 Add body to string representation (if valid).
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
 **                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
 **                  be tracked.
@@ -379,7 +380,7 @@
    {
       return function(this, "ToString", character.class, new Block((Body) () ->
       {
-         returnNormal(TextOps.substitute("&1_&2", getContentType(), handle.resourceId(ObjectOps.asResource(this))));
+         returnNormal(TextOps.substitute("&1_&2", getContentType(), body._isValid() ? body.ref().toLegacyString() : handle.resourceId(ObjectOps.asResource(this))));
       }
       ));
    }

=== modified file 'src/com/goldencode/p2j/oo/net/MultipartEntity.java'
--- src/com/goldencode/p2j/oo/net/MultipartEntity.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/MultipartEntity.java	2022-02-11 15:26:27 +0000
@@ -12,6 +12,7 @@
 **         20201123 Assert positive index on remove (OE 12.2).
 ** 005 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
 ** 006 ME  20210303 Increment/decrement object references for entity parts.
+**     ME  20210929 Fix return object on getPart.
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
 **                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
 **                  be tracked.
@@ -365,13 +366,17 @@
    public object<? extends MessagePart> getPart(final integer _n)
    {
       integer n = TypeFactory.initInput(_n);
+      object<? extends MessagePart> part = TypeFactory.object(MessagePart.class);
       
       return function(this, "GetPart", object.class, new Block((Body) () -> {
          Assert.isPositive(n, new character("Part num"));
          
-         Optional<OrderedPart> part = parts.stream().filter(p -> p.num == n.intValue()).findFirst();
-         
-         returnNormal(part.isPresent() ? part.get().entity : new object(MessagePart.class));
+         Optional<OrderedPart> opt = parts.stream().filter(p -> p.num == n.intValue()).findFirst();
+         
+         if (opt.isPresent())
+            part.assign(opt.get().entity);
+         
+         returnNormal(part);
       }));
    }
 

=== modified file 'src/com/goldencode/p2j/oo/net/Uri.java'
--- src/com/goldencode/p2j/oo/net/Uri.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/Uri.java	2022-02-11 15:26:27 +0000
@@ -19,6 +19,7 @@
 **     OM  20210323 Reworked I18n in LOB implementation.
 **     VVT 20210917 Javadoc fixed.
 **     OM  20210917 Code maintenance.
+**     ME  20210929 Fix return object on parse/resolveRelativeReference.
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
 **                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
 **                  be tracked.
@@ -209,31 +210,41 @@
    @LegacySignature(returns = "INTEGER", type = Type.GETTER, name = "SCHEME_PART_IDX")
    public static integer getSchemePartIdx()
    {
-      return schemePartIdx.get();
+      return function(Uri.class, "SCHEME_PART_IDX", integer.class, new Block((Body) () -> {
+         returnNormal(schemePartIdx.get());
+      }));
    }
 
    @LegacySignature(returns = "INTEGER", type = Type.GETTER, name = "AUTHORITY_PART_IDX")
    public static integer getAuthorityPartIdx()
    {
-      return authorityPartIdx.get();
+      return function(Uri.class, "AUTHORITY_PART_IDX", integer.class, new Block((Body) () -> {
+         returnNormal(authorityPartIdx.get());
+      }));
    }
 
    @LegacySignature(returns = "INTEGER", type = Type.GETTER, name = "PATH_PART_IDX")
    public static integer getPathPartIdx()
    {
-      return pathPartIdx.get();
+      return function(Uri.class, "PATH_PART_IDX", integer.class, new Block((Body) () -> {
+         returnNormal(pathPartIdx.get());
+      }));
    }
 
    @LegacySignature(returns = "INTEGER", type = Type.GETTER, name = "QUERY_PART_IDX")
    public static integer getQueryPartIdx()
    {
-      return queryPartIdx.get();
+      return function(Uri.class, "QUERY_PART_IDX", integer.class, new Block((Body) () -> {
+         returnNormal(queryPartIdx.get());
+      }));
    }
 
    @LegacySignature(returns = "INTEGER", type = Type.GETTER, name = "FRAGMENT_PART_IDX")
    public static integer getFragmentPartIdx()
    {
-      return fragmentPartIdx.get();
+      return function(Uri.class, "FRAGMENT_PART_IDX", integer.class, new Block((Body) () -> {
+         returnNormal(fragmentPartIdx.get());
+      }));
    }
 
    private static void _appendEscape(StringBuffer sb, byte b)
@@ -365,7 +376,9 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
    public character getBaseUri()
    {
-      return new character(_getBaseUri());
+      return function(this, "BaseURI", character.class, new Block((Body) () -> {
+         returnNormal(new character(_getBaseUri()));
+      }));
    }
 
    public String _getBaseUri()
@@ -382,22 +395,32 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public character getFragment()
    {
-      return fragment;
+      return function(this, "Fragment", character.class, new Block((Body) () -> {
+         returnNormal(fragment);
+      }));
+      
    }
 
    @LegacySignature(type = Type.SETTER, name = "Fragment", parameters = {
-            @LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT") })
-   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
-   public void setFragment(final character var)
+            @LegacyParameter(name = "_var", type = "CHARACTER", mode = "INPUT") })
+   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | CVT_LVL_FULL)
+   public void setFragment(final character _var)
    {
-      fragment.assign(var.isUnknown() ? "" : var);
+      character var = TypeFactory.initInput(_var);
+      
+      internalProcedure(Uri.class, this, "Fragment", new Block((Body) () -> 
+      {
+         fragment.assign(var.isUnknown() ? "" : var);
+      }));
    }
 
    @LegacySignature(returns = "CHARACTER", type = Type.GETTER, name = "Host")
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
    public character getHost()
    {
-      return host;
+      return function(this, "Host", character.class, new Block((Body) () -> {
+         returnNormal(host);
+      }));
    }
 
    protected String _getAuthority() {
@@ -451,96 +474,128 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public character getPassword()
    {
-      return password;
+      return function(this, "Password", character.class, new Block((Body) () -> {
+         returnNormal(password);
+      }));
    }
 
    @LegacySignature(type = Type.SETTER, name = "Password", parameters = {
-            @LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT") })
-   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
-   public void setPassword(final character var)
+            @LegacyParameter(name = "_var", type = "CHARACTER", mode = "INPUT") })
+   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | CVT_LVL_FULL)
+   public void setPassword(final character _var)
    {
-      password.assign(var);
+      character var = TypeFactory.initInput(_var);
+      
+      internalProcedure(Uri.class, this, "Password", new Block((Body) () -> 
+      {
+         password.assign(var);
+      }));
    }
 
    @LegacySignature(returns = "CHARACTER", type = Type.GETTER, name = "Path")
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
    public character getPath()
    {
-      return path;
+      return function(this, "Path", character.class, new Block((Body) () -> {
+         returnNormal(path);
+      }));
    }
 
    @LegacySignature(type = Type.SETTER, name = "Path", parameters = {
-            @LegacyParameter(name = "pPath", type = "CHARACTER", mode = "INPUT") })
+            @LegacyParameter(name = "_pPath", type = "CHARACTER", mode = "INPUT") })
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
-   public void setPath(final character pPath)
+   public void setPath(final character _pPath)
    {
-      Assert.notNullOrEmpty(pPath, new character("path"));
-      
-      // no validation nor encoding, this is probably a bug and should just call protected setPath method instead
-      String newPath = pPath.getValue();
-      
-      if (!newPath.startsWith("/"))
-         newPath = "/" + newPath;
-      
-      path.assign(newPath);
+      character pPath = TypeFactory.initInput(_pPath);
+      
+      internalProcedure(Uri.class, this, "Path", new Block((Body) () -> 
+      {
+         Assert.notNullOrEmpty(pPath, new character("path"));
+         
+         // no validation nor encoding, this is probably a bug and should just call protected setPath method instead
+         String newPath = pPath.getValue();
+         
+         if (!newPath.startsWith("/"))
+            newPath = "/" + newPath;
+         
+         path.assign(newPath);
+      }));
    }
 
    @LegacySignature(type = Type.METHOD, name = "SetPath", parameters = {
-            @LegacyParameter(name = "pPath", type = "CHARACTER", mode = "INPUT") })
+            @LegacyParameter(name = "_pPath", type = "CHARACTER", mode = "INPUT") })
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
-   protected void setPath_1(final character pPath)
+   protected void setPath_1(final character _pPath)
    {
-      String newPath = pPath.isUnknown() ? "/" : pPath.getValue();
-      
-      if (!newPath.startsWith("/"))
-         newPath = "/" + newPath;
-      
-      if (newPath.length() > 1) {
-         String[] entries = TextOps.entries(newPath, "/");
-         
-         newPath = Arrays.stream(entries).map(p -> _encodeString(p, null, pathAllowed, false)).collect(Collectors.joining("/"));
-      }
-      
-      path.assign(newPath);
+      character pPath = TypeFactory.initInput(_pPath);
+      
+      internalProcedure(Uri.class, this, "SetPath", new Block((Body) () -> 
+      {
+         String newPath = pPath.isUnknown() ? "/" : pPath.getValue();
+         
+         if (!newPath.startsWith("/"))
+            newPath = "/" + newPath;
+         
+         if (newPath.length() > 1) {
+            String[] entries = TextOps.entries(newPath, "/");
+            
+            newPath = Arrays.stream(entries).map(p -> _encodeString(p, null, pathAllowed, false)).collect(Collectors.joining("/"));
+         }
+         
+         setPath(new character(newPath));
+      }));
    }
 
    @LegacySignature(returns = "INTEGER", type = Type.GETTER, name = "Port")
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public integer getPort()
    {
-      return port;
+      return function(this, "Port", integer.class, new Block((Body) () -> {
+         returnNormal(port);
+      }));
    }
 
    @LegacySignature(type = Type.SETTER, name = "Port", parameters = {
-            @LegacyParameter(name = "var", type = "INTEGER", mode = "INPUT") })
+            @LegacyParameter(name = "_var", type = "INTEGER", mode = "INPUT") })
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
-   public void setPort(final integer var)
+   public void setPort(final integer _var)
    {
-      port.assign(var);
+      integer var = TypeFactory.initInput(_var);
+      
+      internalProcedure(Uri.class, this, "Port", new Block((Body) () -> 
+      {
+         port.assign(var);
+      }));
    }
 
    @LegacySignature(returns = "OBJECT", qualified = "OpenEdge.Core.Collections.IStringStringMap", type = Type.GETTER, name = "QueryMap")
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    protected object<? extends com.goldencode.p2j.oo.core.collections.IStringStringMap> getQueryMap()
    {
-      if (queryMap.isUnknown())
-         queryMap.assign(ObjectOps.newInstance(StringStringMap.class));
+      return function(this, "QueryMap", object.class, new Block((Body) () -> {
+         if (queryMap.isUnknown())
+            queryMap.assign(ObjectOps.newInstance(StringStringMap.class));
 
-      return queryMap;
+         returnNormal(queryMap);
+      }));
    }
 
    @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "GetQueryMap", qualified = "openedge.core.collections.istringstringmap")
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public object<? extends com.goldencode.p2j.oo.core.collections.IStringStringMap> getQueryMap_1()
    {
-      return ObjectOps.newInstance(StringStringMap.class, "I", getQueryMap());
+      return function(this, "GetQueryMap", object.class, new Block((Body) () -> {
+         returnNormal(ObjectOps.newInstance(StringStringMap.class, "I", getQueryMap()));
+      }));
    }
 
    @LegacySignature(returns = "CHARACTER", type = Type.GETTER, name = "QueryString")
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
    public character getQueryString()
    {
-      return new character(_getQueryString(false));
+      return function(this, "QueryString", character.class, new Block((Body) () -> {
+         returnNormal(new character(_getQueryString(false)));
+      }));
    }
 
    private void _setQueryString(final character var)
@@ -583,7 +638,9 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
    public character getRelativeUri()
    {
-      return new character(_getRelativeUri());
+      return function(this, "RelativeURI", character.class, new Block((Body) () -> {
+         returnNormal(new character(_getRelativeUri()));
+      }));
    }
 
    public String _getRelativeUri()
@@ -605,21 +662,30 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
    public character getScheme()
    {
-      return scheme;
+      return function(this, "Scheme", character.class, new Block((Body) () -> {
+         returnNormal(scheme);
+      }));
    }
 
    @LegacySignature(returns = "CHARACTER", type = Type.GETTER, name = "User")
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
    public character getUser()
    {
-      return user;
+      return function(this, "User", character.class, new Block((Body) () -> {
+         returnNormal(user);
+      }));
    }
 
    @LegacySignature(type = Type.SETTER, name = "User", parameters = {
-            @LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT") })
-   public void setUser(final character var)
+            @LegacyParameter(name = "_var", type = "CHARACTER", mode = "INPUT") })
+   public void setUser(final character _var)
    {
-      user.assign(var);
+      character var = TypeFactory.initInput(_var);
+      
+      internalProcedure(Uri.class, this, "User", new Block((Body) () -> 
+      {
+         user.assign(var);
+      }));
    }
 
    @LegacySignature(type = Type.CONSTRUCTOR)
@@ -708,41 +774,45 @@
    public void __net_Uri_constructor__(final character pScheme, final character pAuthority,
             final character pPath, final character pQuery, final character pFragment)
    {
-      __lang_BaseObject_constructor__();
-      Assert.notNullOrEmpty(pScheme, new character("Scheme"));
-      scheme.assign(pScheme);
-
-      setAuthority(pAuthority, new logical(true));
-
-      if (pPath.isUnknown() || pPath.getValue().trim().isEmpty())
-      {
-         path.assign("/");
-      }
-      else
-      {
-         setPath(encodeFragment(pPath));
-      }
-
-      _setQueryString(pQuery);
-      setFragment(pFragment);
+      character scheme = TypeFactory.initInput(pScheme);
+      character authority = TypeFactory.initInput(pAuthority);
+      character path = TypeFactory.initInput(pPath);
+      character fragment = TypeFactory.initInput(pFragment);
+      character query = TypeFactory.initInput(pQuery);
+      
+      internalProcedure(this, "__net_Uri_constructor__", new Block((Body) () -> {
+         __lang_BaseObject_constructor__();
+         Assert.notNullOrEmpty(scheme, new character("URI Scheme"));
+         this.scheme.assign(scheme);
+   
+         setAuthority(authority, new logical(true));
+   
+         setPath_1(path);
+   
+         addQueryString(query, new logical(true));
+         setFragment(fragment);
+      }));
    }
 
    @LegacySignature(type = Type.METHOD, name = "AddPathSegment", parameters = {
-            @LegacyParameter(name = "p1", type = "CHARACTER", mode = "INPUT") })
-   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
-   public void addPathSegment(final character p1)
+            @LegacyParameter(name = "_p1", type = "CHARACTER", mode = "INPUT") })
+   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | CVT_LVL_FULL)
+   public void addPathSegment(final character _p1)
    {
-
-      character seg = encodePath(p1);
-
-      if (!seg.getValue().trim().isEmpty())
-      {
-         if (this.path.getValue().endsWith("/"))
-            this.path.assign(this.path.getValue() + seg.getValue());
-         else
-            this.path.assign(this.path.getValue() + "/" + seg.getValue());
-
-      }
+      character p1 = TypeFactory.initInput(_p1);
+      
+      internalProcedure(this, "AddPathSegment", new Block((Body) () -> {
+         character seg = encodePath(p1);
+   
+         if (!seg.getValue().trim().isEmpty())
+         {
+            if (this.path.getValue().endsWith("/"))
+               this.path.assign(this.path.getValue() + seg.getValue());
+            else
+               this.path.assign(this.path.getValue() + "/" + seg.getValue());
+   
+         }
+      }));
    }
 
    @LegacySignature(type = Type.METHOD, name = "AddQuery", parameters = {
@@ -1428,7 +1498,6 @@
 
       character p1 = TypeFactory.initInput(_p1);
       logical p2 = TypeFactory.initInput(_p2);
-
       object<Uri> obj = TypeFactory.object(Uri.class);
 
       return function(Uri.class, "Parse", object.class, new Block((Body) () -> {

=== modified file 'src/com/goldencode/p2j/oo/net/http/ClientBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/ClientBuilder.java	2021-05-24 06:41:34 +0000
+++ src/com/goldencode/p2j/oo/net/http/ClientBuilder.java	2021-10-13 13:43:50 +0000
@@ -12,6 +12,7 @@
 ** 005 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
 ** 006 ME  20210519 Fix registry lazy loading.
+**     ME  20210929 Fix return object on build.
 */
 
 /*
@@ -175,15 +176,15 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public static object<? extends com.goldencode.p2j.oo.net.http.ClientBuilder> build()
    {
-      return function(ClientBuilder.class, "Build", object.class, new Block((Body) () ->
-      {
+      object<? extends ClientBuilder> builder = TypeFactory.object(ClientBuilder.class);
+
+      return function(ClientBuilder.class, "Build", object.class, new Block((Body) () -> {
          object<? extends LegacyClass> builderType = getRegistry().ref()
                   .get(new character(ObjectOps.getLegacyName(ClientBuilder.class)));
-         
+
          Assert.isType(builderType, ObjectOps.getLegacyClass(ClientBuilder.class));
 
-         object<? extends _BaseObject_> builder = ObjectOps
-                  .newInstance(builderType.ref().getType());
+         builder.assign(ObjectOps.newInstance(builderType.ref().getType()));
 
          if (!builder.isUnknown() && builder.ref() instanceof ISupportInitialize)
             ((ISupportInitialize) builder.ref()).initialize();
@@ -248,7 +249,7 @@
             final object<? extends com.goldencode.p2j.oo.net.http.IhttpClient> p2)
    {
       object<? extends com.goldencode.p2j.oo.lang.LegacyClass> _p1 = TypeFactory.initInput(p1);
-      object<? extends _BaseObject_> client = TypeFactory.object(IhttpClient.class);
+      object<? extends IhttpClient> client = TypeFactory.object(IhttpClient.class);
       
       return function(ClientBuilder.class, "DecorateClient", object.class,  new Block((Body) () -> {
          
@@ -305,7 +306,7 @@
    {
       return function(null, "Registry", object.class, new Block((Body) () ->
       {
-         if (!registry.get().isValid().booleanValue()) {
+         if (!registry.get()._isValid()) {
             registry.get().assign(ObjectOps.newInstance(BuilderRegistry.class));
             initializeRegistry(registry.get());
          }

=== modified file 'src/com/goldencode/p2j/oo/net/http/Cookie.java'
--- src/com/goldencode/p2j/oo/net/http/Cookie.java	2021-09-17 15:14:10 +0000
+++ src/com/goldencode/p2j/oo/net/http/Cookie.java	2022-02-11 15:26:27 +0000
@@ -13,6 +13,7 @@
 ** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
 **     VVT 20210917 Javadoc fixed. 
+**     ME  20210929 Fix return object on parse.
 */
 
 /*
@@ -416,7 +417,8 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public static object<? extends Cookie> parse(final character p1)
    {
-
+      object<? extends Cookie> returnedCookie = TypeFactory.object(Cookie.class);
+      
       return function(Cookie.class, "Parse", object.class, new Block((Body) () -> {
          Assert.notNullOrEmpty(p1, new character("Cookie"));
 
@@ -497,9 +499,9 @@
 
          }
 
-         object<? extends Cookie> returnedCookie = ObjectOps.newInstance(Cookie.class,
+        returnedCookie.assign(ObjectOps.newInstance(Cookie.class,
                   "IIIIIIIII", name, domain, path, value, maxAge, expires, secure, httpOnly,
-                  version);
+                  version));
 
          returnNormal(returnedCookie);
 

=== modified file 'src/com/goldencode/p2j/oo/net/http/CookieJar.java'
--- src/com/goldencode/p2j/oo/net/http/CookieJar.java	2021-06-09 14:35:48 +0000
+++ src/com/goldencode/p2j/oo/net/http/CookieJar.java	2021-10-13 13:43:50 +0000
@@ -14,6 +14,7 @@
 **                  signature.
 **     CA  20210609 Updated INPUT/INPUT-OUTPUT parameters to the new approach, where they are explicitly 
 **                  initialized at the method's execution, and not at the caller's arguments.
+**     ME  20211012 Increment/decrement object references on add/remove. 
 */
 
 /*
@@ -349,7 +350,7 @@
 
       internalProcedure(CookieJar.class, this, "AddCookie", new Block((Body) () -> {
          Assert.notNull(poCookie, new character("Cookie"));
-         addCookie(poCookie.ref().getDomain(), _poCookie.ref().getPath(), _poCookie);
+         addCookie(poCookie.ref().getDomain(), poCookie.ref().getPath(), poCookie);
       }));
    }
 
@@ -428,13 +429,15 @@
          // persistent first
          all.addAll(_getCookies(persistentCookies.get(), domain, path, http, secure));
          all.addAll(_getCookies(sessionCookies, domain, path, http, secure));
-         extpoCookies[0] = ArrayAssigner.resize(extpoCookies[0], all.size());
          
-         for (int i = 0; i < extpoCookies.length; i++)
-         {
-            extpoCookies[0][i] = all.get(i);
+         if (all.size() > 0) {
+            extpoCookies[0] = ArrayAssigner.resize(extpoCookies[0], all.size());
+            
+            for (int i = 0; i < all.size(); i++)
+            {
+               extpoCookies[0][i].assign(all.get(i));
+            }
          }
-
          returnNormal(new integer(extpoCookies[0].length));
       }));
    }
@@ -461,14 +464,19 @@
             List<CookieJarEntry> store)
    {
 
-      Optional<CookieJarEntry> entry = store.stream()
+      Optional<CookieJarEntry> first = store.stream()
                .filter(e -> e.domain.equalsIgnoreCase(cookie.getDomain().getValue())
                         && e.path.equalsIgnoreCase(cookie.getPath().getValue())
                         && e.name.equalsIgnoreCase(cookie.getName().getValue()))
                .findFirst();
 
-      if (entry.isPresent()) {
-         return store.remove(entry.get());
+      if (first.isPresent()) {
+         CookieJarEntry entry = first.get();
+         if (store.remove(entry)) {
+            if (entry.cookie._isValid())
+               ObjectOps.decrement(entry.cookie.ref());
+            return true;
+         }
       }
       
       return false;
@@ -476,21 +484,27 @@
 
    private void _addCookie(CookieJarEntry cookie, List<CookieJarEntry> store)
    {
-      Optional<CookieJarEntry> entry = store.stream()
+      Optional<CookieJarEntry> find = store.stream()
                .filter(e -> e.domain.equalsIgnoreCase(cookie.domain)
                         && e.path.equalsIgnoreCase(cookie.path)
                         && e.name.equalsIgnoreCase(cookie.name))
                .findFirst();
 
-      if (entry.isPresent())
+      if (find.isPresent())
       {
          // already have a cookie with same name for domain/path pair
-         entry.get().cookie.assign(cookie.cookie);
+         CookieJarEntry entry = find.get();
+         if (entry.cookie._isValid())
+            ObjectOps.decrement(entry.cookie.ref());
+         
+         entry.cookie.assign(cookie.cookie);
       }
       else
       {
          store.add(cookie);
       }
+      
+      ObjectOps.increment(cookie.cookie.ref());
    }
 
    private boolean _isExpired(Cookie cookie)

=== modified file 'src/com/goldencode/p2j/oo/net/http/CookieJarBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/CookieJarBuilder.java	2021-05-24 06:41:34 +0000
+++ src/com/goldencode/p2j/oo/net/http/CookieJarBuilder.java	2021-10-13 13:43:50 +0000
@@ -123,7 +123,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
    public static object<? extends BuilderRegistry> getRegistry()
    {
-      return function(null, "Registry", object.class, new Block((Body) () -> 
+      return function(CookieJarBuilder.class, "Registry", object.class, new Block((Body) () -> 
       {
          if(!registry.get()._isValid())
          {

=== modified file 'src/com/goldencode/p2j/oo/net/http/DefaultCookieJarBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/DefaultCookieJarBuilder.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/net/http/DefaultCookieJarBuilder.java	2021-10-13 13:43:50 +0000
@@ -10,6 +10,7 @@
 **          20201028 Fix ctor and jar supporting initialization.
 ** 003 CA   20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                   signature.
+**     ME   20210929 Fix return object on getCookieJar.
 */
 
 /*
@@ -127,6 +128,8 @@
    @Override
    public object<? extends ICookieJar> getCookieJar()
    {
+      object<? extends ICookieJar> cookieJar = TypeFactory.object(ICookieJar.class);
+      
       return function(this, "CookieJar", object.class, new Block((Body)() ->
       {
          object<? extends LegacyClass> cookieJarType = CookieJarBuilder.getRegistry().ref()
@@ -134,8 +137,7 @@
          
          Assert.isType(cookieJarType, ObjectOps.getLegacyClass(ICookieJar.class));
          
-         object<? extends ICookieJar> cookieJar = (object<? extends ICookieJar>) 
-                  ObjectOps.newInstance(cookieJarType.ref().getType());
+         cookieJar.assign(ObjectOps.newInstance(cookieJarType.ref().getType()));
          
          if (hasOption(new character(OPTION_PERSIST_TO)).booleanValue())
          {

=== modified file 'src/com/goldencode/p2j/oo/net/http/DefaultHeaderBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/DefaultHeaderBuilder.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/http/DefaultHeaderBuilder.java	2022-02-11 15:26:27 +0000
@@ -9,6 +9,7 @@
 ** 002 ME   20200512 Add header parameters.
 **          20201204 Fix function block scope for error handling.
 ** 003 CA   20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
+**     ME   20210929 Fix return object on newHeader.
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
 **                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
 **                  be tracked.

=== modified file 'src/com/goldencode/p2j/oo/net/http/DefaultHttpClientBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/DefaultHttpClientBuilder.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/net/http/DefaultHttpClientBuilder.java	2021-10-13 13:43:50 +0000
@@ -10,6 +10,7 @@
 **          20201022 Add new protected method newClient (OE 12.2)
 ** 003 CA   20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                   signature.
+**     ME   20210929 Fix return object on newClient.
 */
 
 /*
@@ -136,8 +137,9 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    protected object<? extends IhttpClient> newClient()
    {
-      return function(this, "NewClient", object.class, new Block((Body) () ->
-      {
+      object<? extends IhttpClient> client = TypeFactory.object(IhttpClient.class);
+
+      return function(this, "NewClient", object.class, new Block((Body) () -> {
          Assert.isTrue(hasOption(getPropClientName()));
          Assert.isTrue(hasOption(getPropClientVersion()));
 
@@ -146,9 +148,9 @@
 
          Assert.isType(clientType, ObjectOps.getLegacyClass(HttpClient.class));
 
-         object<? extends IhttpClient> client = (object<? extends IhttpClient>) ObjectOps
-                  .newInstance(clientType.ref().getType(), "III", getOptionStringValue(this.getPropClientName()),
-                           getOptionStringValue(this.getPropClientVersion()), buildLibrary());
+         client.assign(ObjectOps.newInstance(clientType.ref().getType(), "III",
+                  getOptionStringValue(this.getPropClientName()),
+                  getOptionStringValue(this.getPropClientVersion()), buildLibrary()));
 
          if (!client.isUnknown())
          {
@@ -188,8 +190,8 @@
             option.assign(ObjectOps.getLegacyName(ICookieJar.class));
             if (hasOption(option).booleanValue())
             {
-               client = ClientBuilder.decorateClient(
-                        ObjectOps.getLegacyClass(ISupportCookies.class), client);
+               client.assign(ClientBuilder
+                        .decorateClient(ObjectOps.getLegacyClass(ISupportCookies.class), client));
                ((ISupportCookies) client.ref()).setCookieJar(
                         (object<? extends ICookieJar>) getOptionObjectValue(option));
             }
@@ -198,8 +200,8 @@
             option.assign(ObjectOps.getLegacyName(ISupportProxy.class));
             if (hasOption(option).booleanValue())
             {
-               client = ClientBuilder
-                        .decorateClient(ObjectOps.getLegacyClass(ISupportProxy.class), client);
+               client.assign(ClientBuilder
+                        .decorateClient(ObjectOps.getLegacyClass(ISupportProxy.class), client));
                ((ISupportProxy) client.ref())
                         .setProxyUri((object<? extends Uri>) getOptionObjectValue(option));
             }

=== modified file 'src/com/goldencode/p2j/oo/net/http/DefaultResponseBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/DefaultResponseBuilder.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/net/http/DefaultResponseBuilder.java	2021-10-13 13:43:50 +0000
@@ -10,6 +10,7 @@
 ** 003 ME   20201029 Implement as per OE12.2.
 ** 004 CA   20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                   signature.
+**     ME 20210929   Fix return object on getResponse.
 */
 
 /*
@@ -76,7 +77,6 @@
 import com.goldencode.p2j.oo.core.Assert;
 import com.goldencode.p2j.oo.core.ISupportInitialize;
 import com.goldencode.p2j.oo.lang.LegacyClass;
-import com.goldencode.p2j.oo.lang._BaseObject_;
 import com.goldencode.p2j.util.*;
 import com.goldencode.p2j.util.BlockManager.Action;
 import com.goldencode.p2j.util.BlockManager.Condition;
@@ -108,6 +108,8 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
    public object<? extends com.goldencode.p2j.oo.net.http.IhttpResponse> getResponse()
    {
+      object<? extends IhttpResponse> response = TypeFactory.object(IhttpResponse.class);
+      
       return function(DefaultResponseBuilder.class, this, "Response", object.class, new Block((Body) () -> 
       {
          object<? extends LegacyClass> responseCls = ObjectOps
@@ -117,7 +119,7 @@
          
          Assert.isType(responseType, responseCls);
 
-         object<? extends _BaseObject_> response = ObjectOps.newInstance(responseType.ref().getType());
+         response.assign(ObjectOps.newInstance(responseType.ref().getType()));
 
          if (response._isValid() && response.ref() instanceof ISupportInitialize)
             ((ISupportInitialize) response.ref()).initialize();

=== modified file 'src/com/goldencode/p2j/oo/net/http/HttpClient.java'
--- src/com/goldencode/p2j/oo/net/http/HttpClient.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/http/HttpClient.java	2022-02-11 15:26:27 +0000
@@ -15,6 +15,7 @@
 **     CA  20210221 Fixed parameters at the LegacySignature annotation.
 ** 007 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
 ** 008 ME  20210524 Added support for retries, destroy library and fix variable scope on execute.
+**     ME  20210929 Fix return object on instance method.
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
 **                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
 **                  be tracked.

=== modified file 'src/com/goldencode/p2j/oo/net/http/HttpHeader.java'
--- src/com/goldencode/p2j/oo/net/http/HttpHeader.java	2021-05-24 06:41:34 +0000
+++ src/com/goldencode/p2j/oo/net/http/HttpHeader.java	2021-10-13 13:43:50 +0000
@@ -316,7 +316,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
    public static object<? extends HttpHeader> getNullHeader()
    {
-      return function(null, "NullHeader", object.class, new Block((Body) () -> 
+      return function(HttpHeader.class, "NullHeader", object.class, new Block((Body) () -> 
       {
          if (!NULL.get()._isValid())
          {

=== modified file 'src/com/goldencode/p2j/oo/net/http/ResponseBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/ResponseBuilder.java	2021-05-24 06:41:34 +0000
+++ src/com/goldencode/p2j/oo/net/http/ResponseBuilder.java	2021-10-13 13:43:50 +0000
@@ -12,7 +12,8 @@
 ** 004 CA   20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                   signature.
 **     ME   20210310 Add block 'referent' for static methods.
-** 005 ME  20210519 Fix registry lazy loading.
+** 005 ME   20210519 Fix registry lazy loading.
+**     ME   20210929 Fix return object on build.
 */
 
 /*
@@ -80,7 +81,6 @@
 import com.goldencode.p2j.oo.core.*;
 import com.goldencode.p2j.oo.core.util.ConfigBuilder;
 import com.goldencode.p2j.oo.lang.LegacyClass;
-import com.goldencode.p2j.oo.lang._BaseObject_;
 import com.goldencode.p2j.security.*;
 import com.goldencode.p2j.util.*;
 import com.goldencode.p2j.util.BlockManager.Action;
@@ -157,6 +157,8 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
    public static object<? extends ResponseBuilder> build()
    {
+      object<? extends ResponseBuilder> builder = TypeFactory.object(ResponseBuilder.class);
+      
       return function(ResponseBuilder.class, "Build", object.class, new Block((Body) () -> 
       {
          object<? extends LegacyClass> builderCls = ObjectOps
@@ -166,8 +168,7 @@
          
          Assert.isType(builderType, builderCls);
 
-         object<? extends _BaseObject_> builder = ObjectOps
-                  .newInstance(builderType.ref().getType());
+         builder.assign(ObjectOps.newInstance(builderType.ref().getType()));
 
          if (builder._isValid() && builder.ref() instanceof ISupportInitialize)
             ((ISupportInitialize) builder.ref()).initialize();

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/payload/BinaryBodyWriter.java'
--- src/com/goldencode/p2j/oo/net/http/filter/payload/BinaryBodyWriter.java	2021-09-17 15:14:10 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/payload/BinaryBodyWriter.java	2022-02-11 15:26:27 +0000
@@ -111,7 +111,7 @@
    @Override
    public character getTransferEncoding()
    {
-      return function(null, "TransferEncoding", character.class, new Block((Body) () -> 
+      return function(this, "TransferEncoding", character.class, new Block((Body) () -> 
       {
          returnNormal(transferEncoding);
       }));

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/payload/BinaryEntityWriter.java'
--- src/com/goldencode/p2j/oo/net/http/filter/payload/BinaryEntityWriter.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/payload/BinaryEntityWriter.java	2021-10-13 13:43:50 +0000
@@ -106,7 +106,7 @@
    @Override
    public character getTransferEncoding()
    {
-      return function(null, "TransferEncoding", character.class, new Block((Body) () -> 
+      return function(this, "TransferEncoding", character.class, new Block((Body) () -> 
       {
          returnNormal(transferEncoding);
       }));

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/payload/DefaultRequestFilter.java'
--- src/com/goldencode/p2j/oo/net/http/filter/payload/DefaultRequestFilter.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/payload/DefaultRequestFilter.java	2022-02-11 15:26:27 +0000
@@ -9,6 +9,7 @@
 ** 002 MP  20210108 Adapt error message and do a cast for method access
 **     ME  20210204 Fix writeMessage and extractEntity methods.
 ** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
+** 004 ME  20210929 Fixed return object on extractEntity.
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
 **                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
 **                  be tracked.
@@ -197,10 +198,11 @@
    protected object<? extends ByteBucket> extractEntity(final object<? extends IhttpRequest> _poRequest)
    {
       object<? extends IhttpRequest> poRequest = TypeFactory.initInput(_poRequest);
+      object<? extends ByteBucket> oMessageBody = TypeFactory.object(ByteBucket.class);
       
       return function(DefaultRequestFilter.class, this, "ExtractEntity", object.class, new Block((Body) () -> 
       {
-         object<? extends ByteBucket> oMessageBody = ByteBucket.instance();
+         oMessageBody.assign(ByteBucket.instance());
          
          object<? extends MessageWriterBuilder> oMWB = BodyWriterBuilder.build_1(poRequest);
          object<? extends MessageWriter> oBodyWriter = oMWB.ref().writeTo(oMessageBody).ref().getWriter();

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/payload/MessageWriter.java'
--- src/com/goldencode/p2j/oo/net/http/filter/payload/MessageWriter.java	2021-09-17 15:14:10 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/payload/MessageWriter.java	2022-02-11 15:26:27 +0000
@@ -120,7 +120,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
    public object<? extends IlogWriter> getLogger()
    {
-      return function(null, "Logger", object.class, new Block((Body) () -> 
+      return function(this, "Logger", object.class, new Block((Body) () -> 
       {
          // TODO: 4Gl uses the LoggerBuilder, change when available
          if (logger.isUnknown())
@@ -160,7 +160,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
    public object<? extends LegacyClass> getEntityType()
    {
-      return function(null, "EntityType", object.class, new Block((Body) () -> 
+      return function(this, "EntityType", object.class, new Block((Body) () -> 
       {
          returnNormal(entityType);
       }));
@@ -175,7 +175,7 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
    public object<? extends BaseObject> getEntity()
    {
-      return function(null, "Entity", object.class, new Block((Body) () -> 
+      return function(this, "Entity", object.class, new Block((Body) () -> 
       {
          returnNormal(entity);
       }));

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartBodyWriter.java'
--- src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartBodyWriter.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartBodyWriter.java	2022-02-11 15:26:27 +0000
@@ -121,7 +121,7 @@
    @Override
    public character getBoundary()
    {
-      return function(null, "Boundary", character.class, new Block((Body) () -> 
+      return function(this, "Boundary", character.class, new Block((Body) () -> 
       {
          returnNormal(boundary);
       }));

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartEntityWriter.java'
--- src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartEntityWriter.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartEntityWriter.java	2022-02-11 15:26:27 +0000
@@ -122,7 +122,7 @@
    @Override
    public character getBoundary()
    {
-      return function(null, "Boundary", character.class, new Block((Body) () -> 
+      return function(this, "Boundary", character.class, new Block((Body) () -> 
       {
          returnNormal(boundary);
       }));

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/payload/StringEntityWriter.java'
--- src/com/goldencode/p2j/oo/net/http/filter/payload/StringEntityWriter.java	2021-09-17 15:14:10 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/payload/StringEntityWriter.java	2022-02-11 15:26:27 +0000
@@ -114,7 +114,7 @@
    @Override
    public character getEncoding()
    {
-      return function(null, "Encoding", character.class, new Block((Body) () -> 
+      return function(this, "Encoding", character.class, new Block((Body) () -> 
       {
          returnNormal(encoding);
       }));

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/payload/XmlBodyWriter.java'
--- src/com/goldencode/p2j/oo/net/http/filter/payload/XmlBodyWriter.java	2021-09-17 15:14:10 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/payload/XmlBodyWriter.java	2022-02-11 15:26:27 +0000
@@ -118,7 +118,7 @@
    @Override
    public character getEncoding()
    {
-      return function(null, "Encoding", character.class, new Block((Body) () -> 
+      return function(this, "Encoding", character.class, new Block((Body) () -> 
       {
          returnNormal(encoding);
       }));
@@ -255,7 +255,7 @@
          if ( !TextOps.begins(mContent, "<").booleanValue() )
          {
             String errMsg = "Character data does not appear to be XML; starts with \"" + 
-                     TextOps.substring(mContent, 1, 1).getValue() + "\"";                     
+                     TextOps.substring(mContent, 1, TextOps.indexOf(mContent, "<")).getValue() + "\"";                     
             undoThrow(AppError.newInstance(errMsg, 0));
          }
          

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/status/RedirectStatusFilter.java'
--- src/com/goldencode/p2j/oo/net/http/filter/status/RedirectStatusFilter.java	2021-09-17 15:14:10 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/status/RedirectStatusFilter.java	2022-02-11 15:26:27 +0000
@@ -312,7 +312,7 @@
    @Override
    public object<? extends IhttpMessage> getMessage()
    {
-      return function(null, "Message", object.class, new Block((Body) () -> 
+      return function(this, "Message", object.class, new Block((Body) () -> 
       {
          returnNormal(message);
       }));
@@ -343,7 +343,7 @@
    @Override
    public object<? extends IlogWriter> getLogger()
    {
-      return function(null, "Logger", object.class, new Block((Body) () -> 
+      return function(this, "Logger", object.class, new Block((Body) () -> 
       {
          returnNormal(logger);
       }));

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/writer/AuthenticationRequestWriterBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/filter/writer/AuthenticationRequestWriterBuilder.java	2021-05-24 06:41:34 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/writer/AuthenticationRequestWriterBuilder.java	2021-10-13 13:43:50 +0000
@@ -14,6 +14,7 @@
 **                  signature.
 **     ME  20210310 Add block 'referent' for static methods.
 ** 006 ME  20210519 Fix registry lazy loading.
+**     ME  20210929 Fix return object on build.
 */
 
 /*
@@ -172,13 +173,13 @@
       object<? extends com.goldencode.p2j.oo.net.http.filter.auth.IauthFilterEventHandler> poListeners[] = TypeFactory
                .initInput(_poListeners);
 
+      object<? extends AuthenticationRequestFilter> writer = TypeFactory
+               .object(AuthenticationRequestFilter.class);
+      
       return function(AuthenticationRequestWriterBuilder.class, "Build", object.class, new Block((Body) () -> 
       {
          Assert.notNull(poRequest, new character("Request"));
 
-         object<? extends AuthenticationRequestFilter> writer = TypeFactory
-                  .object(AuthenticationRequestFilter.class);
-
          object<? extends LegacyClass> writerCls = getRegistry().ref()
                   .get(poRequest.ref().getAuthenticationMethod());
 

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/writer/BodyWriterBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/filter/writer/BodyWriterBuilder.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/writer/BodyWriterBuilder.java	2022-02-11 15:26:27 +0000
@@ -11,6 +11,7 @@
 ** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
 **     ME  20210310 Add block 'referent' for static methods.
 **     VVT 20210917 Javadoc fixed. 
+**     ME  20210929 Fix return object on build.
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
 **                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
 **                  be tracked.

=== modified file 'src/com/goldencode/p2j/oo/net/http/filter/writer/SetHeaderMessageWriterBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/filter/writer/SetHeaderMessageWriterBuilder.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/http/filter/writer/SetHeaderMessageWriterBuilder.java	2022-02-11 15:26:27 +0000
@@ -12,6 +12,7 @@
 ** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
 ** 005 ME  20210519 Fix registry lazy loading.
 **     VVT 20210917 Javadoc fixed. 
+**     ME  20210929 Fix return object on build.
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
 **                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
 **                  be tracked.

=== modified file 'src/com/goldencode/p2j/oo/net/http/lib/ClientLibraryBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/lib/ClientLibraryBuilder.java	2021-05-24 06:41:34 +0000
+++ src/com/goldencode/p2j/oo/net/http/lib/ClientLibraryBuilder.java	2021-10-13 13:43:50 +0000
@@ -17,6 +17,7 @@
 **                  signature.
 **     ME  20210301 Added class 'referent' for static methods.
 ** 008 ME  20210519 Fix registry lazy loading.
+**     ME  20210929 Fix return object on build.
 */
 
 /*
@@ -272,12 +273,14 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    public static object<? extends ClientLibraryBuilder> build()
    {
+      object<? extends ClientLibraryBuilder> builder = TypeFactory.object(ClientLibraryBuilder.class);
+      
       return function(ClientLibraryBuilder.class, "Build", object.class, new Block((Body) () ->
       {
          object<? extends LegacyClass> builderType = getRegistry().ref().get(new character(CLIENTLIBRARYBUILDER));
          Assert.isType(builderType, ObjectOps.getLegacyClass(ClientLibraryBuilder.class));
 
-         object<? extends _BaseObject_> builder = ObjectOps.newInstance(builderType.ref().getType());
+         builder.assign(ObjectOps.newInstance(builderType.ref().getType()));
 
          if (!builder.isUnknown() && builder.ref() instanceof ISupportInitialize)
             ((ISupportInitialize) builder.ref()).initialize();

=== modified file 'src/com/goldencode/p2j/oo/net/http/lib/sockets/LegacySocketLibrary.java'
--- src/com/goldencode/p2j/oo/net/http/lib/sockets/LegacySocketLibrary.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/oo/net/http/lib/sockets/LegacySocketLibrary.java	2022-02-11 15:26:27 +0000
@@ -432,7 +432,7 @@
          }
 
          // negative port is breaking the connection params (-S -xxxx)
-         if (port.intValue() < 0)
+         if (port.isUnknown() || port.intValue() < 0)
          {
             ErrorManager.recordOrThrowError(new int[] { 1403, 5509, 5510 },
                      new String[] { "You have not supplied a parameter for argument -S",

=== modified file 'src/com/goldencode/p2j/oo/net/http/lib/sockets/LegacySocketLibraryBuilder.java'
--- src/com/goldencode/p2j/oo/net/http/lib/sockets/LegacySocketLibraryBuilder.java	2021-04-02 07:38:02 +0000
+++ src/com/goldencode/p2j/oo/net/http/lib/sockets/LegacySocketLibraryBuilder.java	2021-10-13 13:43:50 +0000
@@ -12,6 +12,7 @@
 ** 005 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
 **     ME  20210402 Added annotations, update support levels.
+**     ME  20210929 Fix return value on createClientSocket, buildSocketConnectionParams.
 */
 
 /*
@@ -172,9 +173,11 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    protected object<? extends ClientSocket> createClientSocket()
    {
+      object<? extends ClientSocket> clSocket = TypeFactory.object(ClientSocket.class);
+      
       return function(this, "CreateClientSocket", object.class, new Block((Body) () ->
       {
-         object<? extends ClientSocket> clSocket = ObjectOps.newInstance(ClientSocket.class);
+         clSocket.assign(ObjectOps.newInstance(ClientSocket.class));
          
          character clSTypName = new character(ObjectOps.getLegacyName(ClientSocket.class));
          character iLogWrtTypName = new character(ObjectOps.getLegacyName(IlogWriter.class));
@@ -208,11 +211,11 @@
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
    protected object<? extends ClientSocketConnectionParameters> buildSocketConnectionParams()
    {      
-      object<? extends ClientSocketConnectionParameters> clSocketConnParam = 
-               ObjectOps.newInstance(ClientSocketConnectionParameters.class);
+      object<? extends ClientSocketConnectionParameters> clSocketConnParam = TypeFactory.object(ClientSocketConnectionParameters.class);
       
       return function(this, "BuildSocketConnectionParams", object.class, new Block((Body) () ->
       {
+         clSocketConnParam.assign(ObjectOps.newInstance(ClientSocketConnectionParameters.class));
          character clSockConnParamTypName = new character("OpenEdge.Net.ServerConnection.ClientSocketConnectionParameters");
          
          if (hasOption(clSockConnParamTypName).booleanValue())

=== modified file 'src/com/goldencode/p2j/oo/reflect/AccessMode.java'
--- src/com/goldencode/p2j/oo/reflect/AccessMode.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/reflect/AccessMode.java	2021-10-22 06:53:10 +0000
@@ -12,6 +12,7 @@
 ** 004 ME  20200423 Drop using context local variables for enums, class not registered.
 ** 005 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
+** 006 ME  20211022 Added package protected/private enum members.
 */
 
 /*
@@ -93,6 +94,12 @@
    @LegacySignature(type = Type.VARIABLE, name = "Private")
    public static final object<? extends AccessMode> private_;
    
+   @LegacySignature(type = Type.VARIABLE, name = "Package-Protected")
+   public static final object<? extends AccessMode> packageProtected;
+   
+   @LegacySignature(type = Type.VARIABLE, name = "Package-Private")
+   public static final object<? extends AccessMode> packagePrivate;
+   
    static
    {
       registerEnum(AccessMode.class, AccessMode::new, "Progress.Reflect.AccessMode");
@@ -100,6 +107,8 @@
       public_ = createEnum(AccessMode.class, "Public");
       protected_ = createEnum(AccessMode.class, "Protected");
       private_ = createEnum(AccessMode.class, "Private");
+      packageProtected = createEnum(AccessMode.class, "Package-Protected");
+      packagePrivate = createEnum(AccessMode.class, "Package-Private");
    }
    
    private AccessMode(String name, long value)

=== modified file 'src/com/goldencode/p2j/oo/reflect/Flags.java'
--- src/com/goldencode/p2j/oo/reflect/Flags.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/reflect/Flags.java	2021-10-22 06:53:10 +0000
@@ -10,6 +10,7 @@
 **     GES 20200521 Changes to match final legacy enum approach.
 ** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
+** 004 ME  20211022 Added package protected/private enum members.
 */
 
 /*
@@ -95,6 +96,12 @@
 
    public static final object<? extends Flags> declaredOnly;
    
+   @LegacySignature(type = Type.VARIABLE, name = "Package-Protected")
+   public static final object<? extends Flags> packageProtected;
+   
+   @LegacySignature(type = Type.VARIABLE, name = "Package-Private")
+   public static final object<? extends Flags> packagePrivate;
+   
    static {
       registerEnum(Flags.class, Flags::new, "Progress.Reflect.Flags");
       
@@ -104,6 +111,8 @@
       static_ = createEnum(Flags.class, "Static");
       instance = createEnum(Flags.class, "Instance");
       declaredOnly = createEnum(Flags.class, "DeclaredOnly");
+      packageProtected = createEnum(Flags.class, "Package-Protected");
+      packagePrivate = createEnum(Flags.class, "Package-Private");
    }
    
    private Flags(String name, long value)

=== modified file 'src/com/goldencode/p2j/oo/reflect/Legacy4GLMethod.java'
--- src/com/goldencode/p2j/oo/reflect/Legacy4GLMethod.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/reflect/Legacy4GLMethod.java	2021-10-28 07:59:30 +0000
@@ -10,6 +10,7 @@
 ** 002 CA  20191024 Added method support levels and updated the class support level.
 ** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
+**     ME  20211028 Added 'POLY' return data type for invoke. 
 */
 
 /*
@@ -69,7 +70,6 @@
 
 import com.goldencode.p2j.util.*;
 import com.goldencode.p2j.oo.lang.*;
-import com.goldencode.p2j.oo.reflect.Parameter;
 
 import static com.goldencode.p2j.util.BlockManager.*;
 import static com.goldencode.p2j.report.ReportConstants.*;
@@ -253,7 +253,7 @@
       }));
    }
 
-   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Invoke", qualified = "progress.lang.object", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "Invoke", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "params", type = "OBJECT", qualified = "progress.lang.parameterlist", mode = "INPUT")
    })
@@ -263,20 +263,20 @@
      end.
    */   
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
-   public object<? extends _BaseObject_> invoke(final object<? extends ParameterList> _params)
+   public Object invoke(final object<? extends ParameterList> _params)
    {
       object<? extends ParameterList> params = TypeFactory.initInput(_params);
       
       return function(this, "Invoke", object.class, new Block());
    }
 
-   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Invoke", qualified = "progress.lang.object", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "Invoke", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "instance", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
       @LegacyParameter(name = "params", type = "OBJECT", qualified = "progress.lang.parameterlist", mode = "INPUT")
    })
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
-   public object<? extends _BaseObject_> invoke(final object<? extends _BaseObject_> _instance, final object<? extends ParameterList> _params)
+   public Object invoke(final object<? extends _BaseObject_> _instance, final object<? extends ParameterList> _params)
    {
       object<? extends _BaseObject_> instance = TypeFactory.initInput(_instance);
       object<? extends ParameterList> params = TypeFactory.initInput(_params);

=== modified file 'src/com/goldencode/p2j/oo/reflect/LegacyConstructor.java'
--- src/com/goldencode/p2j/oo/reflect/LegacyConstructor.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/reflect/LegacyConstructor.java	2021-10-28 07:59:30 +0000
@@ -8,6 +8,7 @@
 ** 001 ME  20200421 First version, stubs taken by converting the skeleton using FWD.
 ** 002 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
+**     ME  20211028 Added 'POLY' return data type for invoke.
 */
 
 /*
@@ -158,10 +159,10 @@
       }));
    }
 
-   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Invoke", qualified = "progress.lang.object", parameters = {
+   @LegacySignature(type = Type.METHOD, name = "Invoke", returns = "BDT", parameters = {
             @LegacyParameter(name = "params", type = "OBJECT", qualified = "progress.lang.parameterlist", mode = "INPUT") })
    @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
-   public object<? extends _BaseObject_> invoke(final object<? extends ParameterList> _params)
+   public Object invoke(final object<? extends ParameterList> _params)
    {
       object<? extends ParameterList> params = TypeFactory.initInput(_params);
 

=== modified file 'src/com/goldencode/p2j/oo/reflect/Variable.java'
--- src/com/goldencode/p2j/oo/reflect/Variable.java	2021-02-21 16:25:50 +0000
+++ src/com/goldencode/p2j/oo/reflect/Variable.java	2021-10-28 07:59:30 +0000
@@ -8,6 +8,7 @@
 ** 001 ME  20200422 First version.
 ** 002 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
 **                  signature.
+**     ME  20211028 Use 'POLY' data type for get/set methods.
 */
 
 /*
@@ -66,7 +67,6 @@
 package com.goldencode.p2j.oo.reflect;
 
 import com.goldencode.p2j.util.*;
-
 import static com.goldencode.p2j.report.ReportConstants.*;
 import static com.goldencode.p2j.util.BlockManager.*;
 import static com.goldencode.p2j.util.InternalEntry.Type;
@@ -191,40 +191,40 @@
       }));
    }
 
-   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Get", extent = -1, qualified = "progress.lang.object")
-   public object<? extends _BaseObject_>[] get()
+   @LegacySignature(type = Type.METHOD, name = "Get", returns = "BDT")
+   public Object get()
    {
       return extentFunction(Variable.class, this, "Get", object.class, new Block());
    }
 
-   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Get", extent = -1, qualified = "progress.lang.object", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "Get", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "index", type = "INTEGER", mode = "INPUT")
    })
-   public object<? extends _BaseObject_>[] get(final integer _index)
+   public Object get(final integer _index)
    {
       integer index = TypeFactory.initInput(_index);
       
       return extentFunction(Variable.class, this, "Get", object.class, new Block());
    }
 
-   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Get", extent = -1, qualified = "progress.lang.object", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "Get", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "instance", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
    })
-   public object<? extends _BaseObject_>[] get(final object<? extends _BaseObject_> _instance)
+   public Object get(final object<? extends _BaseObject_> _instance)
    {
       object<? extends _BaseObject_> instance = TypeFactory.initInput(_instance);
       
       return extentFunction(Variable.class, this, "Get", object.class, new Block());
    }
 
-   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Get", extent = -1, qualified = "progress.lang.object", parameters = 
+   @LegacySignature(type = Type.METHOD, name = "Get", returns = "BDT", parameters = 
    {
       @LegacyParameter(name = "instance", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
       @LegacyParameter(name = "index", type = "INTEGER", mode = "INPUT")
    })
-   public object<? extends _BaseObject_>[] get(final object<? extends _BaseObject_> _instance, final integer _index)
+   public Object get(final object<? extends _BaseObject_> _instance, final integer _index)
    {
       object<? extends _BaseObject_> instance = TypeFactory.initInput(_instance);
       integer index = TypeFactory.initInput(_index);
@@ -232,55 +232,51 @@
       return extentFunction(Variable.class, this, "Get", object.class, new Block());
    }
 
-   @LegacySignature(type = Type.METHOD, name = "Set", parameters = 
-   {
-      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
-   })
-   public void set(final object<? extends _BaseObject_> _value)
-   {
-      object<? extends _BaseObject_> value = TypeFactory.initInput(_value);
-      
-      internalProcedure(Variable.class, this, "Set", new Block());
-   }
-
-   @LegacySignature(type = Type.METHOD, name = "Set", parameters = 
-   {
-      @LegacyParameter(name = "index", type = "INTEGER", mode = "INPUT"),
-      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
-   })
-   public void set(final integer _index, final object<? extends _BaseObject_> _value)
-   {
-      integer index = TypeFactory.initInput(_index);
-      object<? extends _BaseObject_> value = TypeFactory.initInput(_value);
-      
-      internalProcedure(Variable.class, this, "Set", new Block());
-   }
-
-   @LegacySignature(type = Type.METHOD, name = "Set", parameters = 
-   {
-      @LegacyParameter(name = "instance", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
-      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
-   })
-   public void set(final object<? extends _BaseObject_> _instance, final object<? extends _BaseObject_> _value)
-   {
-      object<? extends _BaseObject_> instance = TypeFactory.initInput(_instance);
-      object<? extends _BaseObject_> value = TypeFactory.initInput(_value);
-      
-      internalProcedure(Variable.class, this, "Set", new Block());
-   }
-
-   @LegacySignature(type = Type.METHOD, name = "Set", parameters = 
-   {
-      @LegacyParameter(name = "instance", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
-      @LegacyParameter(name = "index", type = "INTEGER", mode = "INPUT"),
-      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
-   })
-   public void set(final object<? extends _BaseObject_> _instance, final integer _index, final object<? extends _BaseObject_> _value)
-   {
-      object<? extends _BaseObject_> instance = TypeFactory.initInput(_instance);
-      integer index = TypeFactory.initInput(_index);
-      object<? extends _BaseObject_> value = TypeFactory.initInput(_value);
-      
-      internalProcedure(Variable.class, this, "Set", new Block());
-   }
+   
+   @LegacySignature(type = Type.METHOD, name = "Set", parameters = 
+   {
+      @LegacyParameter(name = "value", type = "BDT", mode = "INPUT")
+   })
+   public void set(final Object _value)
+   {
+   }
+
+   @LegacySignature(type = Type.METHOD, name = "Set", parameters = 
+   {
+      @LegacyParameter(name = "index", type = "INTEGER", mode = "INPUT"),
+      @LegacyParameter(name = "value", type = "BDT", mode = "INPUT")
+   })
+   public void set(final integer _index, final Object _value)
+   {
+      integer index = TypeFactory.initInput(_index);
+      
+      internalProcedure(Variable.class, this, "Set", new Block());
+   }
+
+   @LegacySignature(type = Type.METHOD, name = "Set", parameters = 
+   {
+      @LegacyParameter(name = "instance", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
+      @LegacyParameter(name = "value", type = "BDT", mode = "INPUT")
+   })
+   public void set(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _instance, final Object _value)
+   {
+      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> instance = TypeFactory.initInput(_instance);
+      
+      internalProcedure(Variable.class, this, "Set", new Block());
+   }
+   
+   @LegacySignature(type = Type.METHOD, name = "Set", parameters = 
+   {
+      @LegacyParameter(name = "instance", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
+      @LegacyParameter(name = "index", type = "INTEGER", mode = "INPUT"),
+      @LegacyParameter(name = "value", type = "BDT", mode = "INPUT")
+   })
+   public void set(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _instance, final integer _index, Object _value)
+   {
+      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> instance = TypeFactory.initInput(_instance);
+      integer index = TypeFactory.initInput(_index);
+      
+      internalProcedure(Variable.class, this, "Set", new Block());
+   }
+   
 }

=== modified file 'src/com/goldencode/p2j/pattern/CommonAstSupport.java'
--- src/com/goldencode/p2j/pattern/CommonAstSupport.java	2021-12-21 18:55:52 +0000
+++ src/com/goldencode/p2j/pattern/CommonAstSupport.java	2022-02-11 15:26:27 +0000
@@ -267,6 +267,7 @@
 **     HC  20211001          Implementation of i18n support.
 **     CA  20211012          Fixed generated WSDL and reworked SOAP support to rely on namespace, when
 **                           resolving an operation.
+**     ME  20211025          Added AST node as input to loadConvertedClass method.
 **     CA  20211214          The AST manager plugin must be context-local, for runtime conversion, as the 
 **                           InMemoryRegistryPlugin is not thread-safe.
 **                           All worker's state must be context-local, for runtime conversion to work in 
@@ -620,15 +621,20 @@
        * @param    isNew
        *           Flag indicating that this is a new class (now being parsed), or a previously
        *           converted class.
+       * @param    ast 
+       *           The abstract syntax tree node.
        *           
        * @return   See above.
        * 
        * @throws   ClassNotFoundException
        *           If the class can't be resolved or loaded.
        */
-      public ConvertedClassName loadConvertedClass(String filename, boolean isNew)
-      throws ClassNotFoundException
+      public ConvertedClassName loadConvertedClass(String filename, boolean isNew, Aast ast)
+               throws ClassNotFoundException
       {
+         if (filename == null)
+            throw new ClassNotFoundException(
+                     "Can not find class for accessing " + ast.toStringVerbose());
          return SymbolResolver.loadConvertedClass(filename, isNew);
       }
       

=== modified file 'src/com/goldencode/p2j/uast/ClassDefinition.java'
--- src/com/goldencode/p2j/uast/ClassDefinition.java	2022-01-28 14:01:01 +0000
+++ src/com/goldencode/p2j/uast/ClassDefinition.java	2022-02-11 15:26:27 +0000
@@ -106,6 +106,7 @@
 **     GES 20210702          Allow parent hierarchy lookup for static methods.  This is a 4GL quirk that is not
 **                           present in Java. See #4978.  Removed dead code and some debugging code. Improved
 **                           support for .NET arrays and .NET generic type parameters.
+**     ME  20211028          Add support for 'virtual' POLY data type on methods return/parameters.
 **     OM  20211122          Added hints-based support for 'unloading' schema.
 **     CA  20220128          Added a NPE protection for exactMethodLookup(), seen in incremental conversion, 
 **                           but with no local duplicate.
@@ -1605,22 +1606,11 @@
          
          if (mdat != null)
          {
-            if (mdat.name.equalsIgnoreCase("invoke") && 
-                (mdat.container.name.equalsIgnoreCase("progress.lang.class") || 
-                 mdat.container.name.equalsIgnoreCase("progress.reflect.method")))
-            {
-               // set the node's type to OO_METH_POLY
-               node.putAnnotation("oldtype", (long) node.getType());
-               node.setType(OO_METH_POLY);
-            }
-            else
-            {
-               // the type may have been set incorrectly based on guessing, since the parameter
-               // signature was not yet available; force it to the correct value here
-               if (node.getType() != FUNC_CLASS)
-               {
-                  node.setType(mdat.type);
-               }
+            // the type may have been set incorrectly based on guessing, since the parameter
+            // signature was not yet available; force it to the correct value here
+            if (node.getType() != FUNC_CLASS)
+            {
+               node.setType(mdat.type);
             }
             
             // the access mode won't necessarily be the same as that passed in
@@ -2916,7 +2906,8 @@
                         }
                      }
                      else if ((!nowrapObjects || !classname.startsWith("object<")) && 
-                              !classname.startsWith("jobject<"))
+                              !classname.startsWith("jobject<") && 
+                              !classname.equals("BaseDataType") && !classname.equals("Object"))
                      {
                         // TODO: CA: what's the reas for nowrapObjects?
                         parm.putAnnotation("wrap_parameter", Boolean.TRUE);
@@ -3428,7 +3419,8 @@
                // unknown value or BDT (POLY cases) match anything
                if (callerType == null                     ||
                    callerType.equals("BaseDataType")      ||
-                   callerType.equals("unknown"))
+                   callerType.equals("unknown")           || 
+                   candidateType.equals("Object"))
                {
                   exact = false;
                   continue inner;

=== modified file 'src/com/goldencode/p2j/uast/SymbolResolver.java'
--- src/com/goldencode/p2j/uast/SymbolResolver.java	2022-01-28 14:01:01 +0000
+++ src/com/goldencode/p2j/uast/SymbolResolver.java	2022-02-11 15:26:27 +0000
@@ -452,6 +452,7 @@
 **     GES 20210715          Added loadConvertedClassByQname().
 **     CA  20210920          Added NPE protection for some registries, for runtime conversion.
 **     HC  20211001          Implementation of i18n support.
+**     ME  20211026          Added support for POLY data type.
 **     OM  20211122          Added hints-based support for 'unloading' schema.
 **     CA  20220113          Widget lookup must not be performed (and return 'no match') if the closest 
 **                           definition is a variable which can't be a widget (HANDLE, object, etc).
@@ -1792,6 +1793,9 @@
          case VAR_ROWID:
             cls = "rowid";
             break;
+         case VAR_POLY:
+            cls = "Object";
+            break;
          case VAR_CLASS:
             cls = "object";
             if (parm != null)

=== modified file 'src/com/goldencode/p2j/uast/progress.g'
--- src/com/goldencode/p2j/uast/progress.g	2022-01-18 07:06:00 +0000
+++ src/com/goldencode/p2j/uast/progress.g	2022-02-11 15:26:27 +0000
@@ -2207,6 +2207,7 @@
 **     SVL 20210804          DB-FIELD-MAPPING is replaced with DB-{SORT|FILTER}-FIELD-MAPPING.
 **     SVL 20210806          Added DISABLE-USER-CFG-EDIT and DISABLE-ROW-STRIPING as attributes.
 **     SVL 20210814          Changed DISABLE-USER-CFG-EDIT to DISABLE-CFG-EDIT.
+**     ME  20211025          Added package protected/private and POLY data type.
 **     HC  20211201          Implemented TREEVIEW:CHECK-BOXES attribute. Added NODE-CHECK
 **                           TREEVIEW trigger.
 **     VVT 20211203          Added KW_CODE_STATE keyword. See #5850-20.
@@ -2966,6 +2967,7 @@
          VAR_RECID;
          VAR_ROWID;
          SYS_HANDLE;
+         VAR_POLY;
          BEGIN_NATIVE_VARTYPES;
             VAR_BYTE;
             VAR_DOUBLE;
@@ -3052,6 +3054,7 @@
          METH_LOGICAL;
          METH_LONGCHAR;
          METH_MEMPTR;
+         METH_POLY;
          METH_RAW;
          METH_RECID;
          METH_ROWID;
@@ -4633,6 +4636,9 @@
       KW_PICK_BTH;
       KW_PIX_COL;
       KW_PIX_ROW;
+      KW_PK_PRIVATE;
+      KW_PK_PROTECTD;
+      KW_POLY;
       KW_POP_MENU;
       KW_POP_ONLY;
       KW_PORTRAIT;
@@ -9817,7 +9823,8 @@
           sec != KW_FLOAT    &&
           sec != KW_LONG     &&
           sec != KW_SHORT    &&
-          sec != KW_UNS_SHRT)
+          sec != KW_UNS_SHRT &&
+          sec != KW_POLY)
       {
          String text    = LT(lookahead).getText().toLowerCase();
          int    newtype = -1;
@@ -10422,6 +10429,7 @@
          case KW_SHORT:
          case KW_UNS_LONG:
          case KW_UNS_SHRT:
+         case KW_POLY:
             return true;
       }
       
@@ -12608,12 +12616,12 @@
    ;
    
 /**
- * Matches <code>KW_PUBLIC</code>, <code>KW_PROTECTD</code> or
- * <code>KW_PRIVATE</code>.
+ * Matches <code>KW_PUBLIC</code>, <code>KW_PROTECTD</code>,
+ * <code>KW_PRIVATE</code>, <code>KW_PK_PROTECTD</code> or  <code>KW_PK_PRIVATE</code>.
  */
 access_mode
    :
-      KW_PUBLIC | KW_PROTECTD | KW_PRIVATE
+      KW_PUBLIC | KW_PROTECTD | KW_PRIVATE  | KW_PK_PROTECTD | KW_PK_PRIVATE
    ;
    
 /**
@@ -12782,6 +12790,7 @@
                                    { mtype = OO_METH_LOGICAL; }
          | KW_LONGCHAR             { mtype = OO_METH_LONGCHAR; }
          | KW_MEMPTR               { mtype = OO_METH_MEMPTR; }
+         | KW_POLY                 { mtype = OO_METH_POLY; }
          | KW_RAW                  { mtype = OO_METH_RAW; }
          | KW_RECID                { mtype = OO_METH_RECID; }
          | KW_ROWID                { mtype = OO_METH_ROWID; }
@@ -13184,6 +13193,7 @@
          | KW_WID_HAND                                          { ftype = FUNC_HANDLE; }
          | KW_RAW                                               { ftype = FUNC_RAW; }
          | KW_MEMPTR                                            { ftype = FUNC_MEMPTR; }
+         | KW_POLY                                              { ftype = FUNC_POLY; }
          | (
               options { generateAmbigWarnings = false; }
               :
@@ -23481,6 +23491,7 @@
          | KW_ROWID                             { vartype = VAR_ROWID; }
          | KW_RAW                               { vartype = VAR_RAW; }
          | KW_MEMPTR                            { vartype = VAR_MEMPTR; }
+         | KW_POLY                              { vartype = VAR_POLY; }
          
            // support the native types if necessary
          | { nativeTypes }?
@@ -31836,6 +31847,7 @@
  *   VAR_RECID
  *   VAR_ROWID
  *   SYS_HANDLE
+ *   VAR_POLY
  *   CLASS_NAME (static OO 4GL class reference)
  *   VAR_BYTE
  *   VAR_DOUBLE
@@ -32269,6 +32281,7 @@
               | VAR_RAW^
               | VAR_RECID^   
               | VAR_ROWID^
+              | VAR_POLY^
               
               // native interface types
               | VAR_BYTE^      | VAR_DOUBLE^  | VAR_FLOAT^   | VAR_LONG^
@@ -35389,6 +35402,8 @@
          new Keyword("owner"                          ,  0, KW_OWNER   , false),
          new Keyword("owner-document"                 ,  0, KW_OWN_DOC , false),
          new Keyword("p2j-remote-call"                ,  0, KW_P2J_RC  , false),  // P2J-extension, not real 4GL!
+         new Keyword("package-private"                ,  0, KW_PK_PRIVATE, false),
+         new Keyword("package-protected"              ,  0, KW_PK_PROTECTD, false),
          new Keyword("page"                           ,  0, KW_PAGE    , true ),
          new Keyword("paged"                          ,  0, KW_PAGED   , false),
          new Keyword("page-bottom"                    ,  8, KW_PAGE_B  , true ),
@@ -35430,6 +35445,7 @@
          new Keyword("pixels"                         ,  0, KW_PIXELS  , true ),
          new Keyword("pixels-per-column"              , 14, KW_PIX_COL , false),
          new Keyword("pixels-per-row"                 ,  0, KW_PIX_ROW , false),
+         new Keyword("_BDT_"                          ,  0, KW_POLY    , false),
          new Keyword("portrait"                       ,  0, KW_PORTRAIT, false),
          new Keyword("position"                       ,  7, KW_POS     , false),
          new Keyword("popup-menu"                     ,  7, KW_POP_MENU, false),


=== modified file 'src/com/goldencode/p2j/util/Call.java'
--- src/com/goldencode/p2j/util/Call.java	2022-01-20 16:27:48 +0000
+++ src/com/goldencode/p2j/util/Call.java	2022-02-14 08:50:25 +0000
@@ -29,6 +29,7 @@
 **                  Reworked INPUT/INPUT-OUTPUT parameters to a new approach, where they are explicitly 
 **                  initialized at the method's execution, and not at the caller's arguments.
 **     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
+**     ME  20220214 Fix variable class type check for block's inline variables.
 */
 
 /*
@@ -2274,6 +2275,10 @@
                   valueCls = _BaseObject_.class;
                }
             }
+            else if (value instanceof BaseDataType)
+            {
+               valueCls = ((BaseDataType) value).getType().getCls();
+            }
             
             if ((valueCls.isAssignableFrom(memptr.class)) && !"MEMPTR".equalsIgnoreCase(dataType)
                      || ("MEMPTR".equalsIgnoreCase(dataType) && !(valueCls.isAssignableFrom(memptr.class))))

