Project

General

Profile

3821c.4384m.patch

Marian Edu, 02/14/2022 03:52 AM

Download (139 KB)

View differences:

rules/annotations/method_defs.rules 2021-10-28 07:59:30 +0000
34 34
**     CA  20210203 Fixed a regression in invokeStandalone or invoke, for Progress.Lang.Class.
35 35
**     CA  20210221 Copy 'qualified' annotation for property getter, to emit at the signature.
36 36
**     CA  20210428 Fixed o:getClass():invoke() when it needs to be emitted as 'invokeStandalone'.
37
**     ME  20211027 Fixed property class name when no getter defined (only set).
37 38
*/
38 39
-->
39 40

  
......
296 297
            isAbstract = isIface or (copy.parent.isAnnotation("abstract") and
297 298
                                     getReferenceNoteBoolean(copy.parent.id, "abstract"))
298 299
         </action>
300
         <action>cls = copy.parent.getAnnotation("classname")</action>
299 301
         
300 302
         <rule>type == prog.kw_get
301
            <action>cls = copy.parent.getAnnotation("classname")</action>
302 303
            <rule>cls.equals("object") or cls.equals("jobject")
303 304
               <action>
304 305
                  objtype = copy.parent.getAnnotation("full-java-class")
rules/annotations/naming.rules 2022-02-11 15:26:27 +0000
48 48
**                           the imported class name is the same name as the program with the 
49 49
**                           import statement.
50 50
**     CA  20210609          Fixed extent property used as output/input-output argument.
51
**     ME  20211022          Send the AST node as input to loadConvertedClass call.
51 52
**     OM  20211111          Added transaction support for finally blocks.
52 53
*/
53 54
 -->
......
298 299
         <!-- this needs to be done first -->
299 300
         <action>setConvertedClassName(file, ooname, fullpkg, classname)</action>
300 301
         <!-- map the source file name to the converted class naming info -->
301
         <action>cclass = loadConvertedClass(file, true)</action>
302
         <action>cclass = loadConvertedClass(file, true, this)</action>
302 303
      </rule>
303 304
      
304 305
      <rule>relativePath("METHOD_DEF/KW_METHOD/SYMBOL")
rules/annotations/oo_references.rules 2021-10-28 07:59:30 +0000
39 39
**                  later on, when that is injected, the proper javaname is used.
40 40
**     GES 20210701 Fix class name references which are to static members of a parent class. This is a 4GL
41 41
**                  quirk.
42
**     ME  20211022 Send the AST node as input to loadConvertedClass call.
42 43
*/
43 44
 -->
44 45
 
......
237 238
               <rule on="false">true
238 239
                  <!-- explicit class import -->
239 240
                  <action>fname = getNoteString("source-file")</action>
240
                  <action>nameinfo = loadConvertedClass(fname, false)</action>
241
                  <action>putNote("legacy-import", nameinfo.getQualifiedName())</action>
241
                  <action>nameinfo = loadConvertedClass(fname, false, this)</action>
242
                  <rule>nameinfo != null
243
                     <action>putNote("legacy-import", nameinfo.getQualifiedName())</action>
244
                  </rule>
242 245
               </rule>
243 246
            </rule>
244 247
         </rule>
......
274 277
            isNote("qualified") and isNote("source-file")
275 278

  
276 279
         <action>fname = getNoteString("source-file")</action>
277
         <action>nameinfo = loadConvertedClass(fname, false)</action>
280
         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
278 281
         
279 282
         <rule>nameinfo != null
280 283
            <action>oname = nameinfo.getQualifiedName()</action>
......
307 310
         <action>copy.parent.putAnnotation("source-file", getNoteString("source-file"))</action>
308 311

  
309 312
         <action>fname = getNoteString("source-file")</action>
310
         <action>nameinfo = loadConvertedClass(fname, false)</action>
313
         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
311 314
         
312 315
         <rule>nameinfo != null
313 316
            <action>copy.parent.putAnnotation("full-java-class", nameinfo.getQualifiedName())</action>
......
327 330
      
328 331
      <rule>this.type == prog.enum_value
329 332
         <action>fname = getNoteString("source-file")</action>
330
         <action>nameinfo = loadConvertedClass(fname, false)</action>
333
         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
331 334
         
332 335
         <rule>nameinfo != null
333 336
            <action>copy.putAnnotation("full-java-class", nameinfo.getQualifiedName())</action>
......
465 468
            
466 469
            <rule on="false">true
467 470
               <action>fname = getNoteString("found-in-source-file")</action>
468
               <action>nameinfo = loadConvertedClass(fname, false)</action>
471
               <action>nameinfo = loadConvertedClass(fname, false, this)</action>
469 472
               <rule>nameinfo != null
470 473
                  <rule>isNote("refid")
471 474
                     <!-- use the javaname at the refid, and not what we thing we should convert to -->
......
578 581
      <rule>this.type == prog.class_event
579 582
         <!-- annotate the event name -->
580 583
         <action>fname = getNoteString("found-in-source-file")</action>
581
         <action>nameinfo = loadConvertedClass(fname, false)</action>
584
         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
582 585
         <action>refid = getNoteLong("refid")</action>
583 586
         
584 587
         <rule>refid == null
......
613 616
          (copy.parent.type == prog.object_invocation and evalLib("input_argument", copy.parent)))
614 617
            
615 618
         <action>fname = getNoteString("cls-container")</action>
616
         <action>nameinfo = loadConvertedClass(fname, false)</action>
619
         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
617 620
         <action>refid = getNoteLong("refid")</action>
618 621
         
619 622
         <rule>refid == null
......
872 875
            !(isNote("cls-property") or getNoteBoolean("cls-property"))
873 876
            
874 877
         <action>fname = getNoteString("found-in-source-file")</action>
875
         <action>nameinfo = loadConvertedClass(fname, false)</action>
878
         <action>nameinfo = loadConvertedClass(fname, false, this)</action>
876 879
         
877 880
         <!-- member vars -->
878 881
         <rule>!isNote("refid") and (!isNote("cls-property") or !getNoteBoolean("cls-property"))
rules/convert/literals.rules 2022-02-11 15:26:27 +0000
144 144
**     CA  20210818          Emit 'instantiateUnknownMemptr' in cases when an unknown argument needs to be
145 145
**                           passed for a memptr parameter.
146 146
**     HC  20211001          Implementation of i18n support.
147
**     ME  20211022          Handle conversion/wrapping for literals when data type is BaseDataType (POLY)
147 148
*/
148 149
 -->
149 150

  
......
396 397
               <rule>type == prog.string 
397 398
                  <!-- if set, get the class from the classname annotation -->
398 399
                  <action>classname = getNoteString("classname")</action>
399
                  <rule>classname == null
400
                  <rule>classname == null or classname.equals("Object")
400 401
                     <action>classname = "character"</action>
401 402
                  </rule>
402 403
               </rule>
......
425 426
            <rule>classname != "date"        and
426 427
                  classname != "datetime"    and
427 428
                  classname != "datetimetz"  and
429
                  !classname.equals("BaseDataType") and
430
                  !classname.equals("Object") and
428 431
                  type != prog.unknown_val
429 432
               <!-- insert an intermediate constructor node -->
430 433
               <action>
src/com/goldencode/ast/AnnotatedAst.java 2021-10-28 07:59:30 +0000
218 218
** 088 CA  20200615          Fixed iterator() when starting from a root with a single child.
219 219
** 089 CA  20201015          Replaced java.util.Stack with a non-synchronized custom implementation.
220 220
** 090 IAS 20210321          Added getImmediateChildren(int type) method 
221
**     ME  20211025          Avoid NPE on toStringVerbose if text is null.
221 222
*/
222 223

  
223 224
/*
......
3563 3564
    */
3564 3565
   public String toStringVerbose()
3565 3566
   {
3566
      StringBuilder sb = new StringBuilder(getText());
3567
      StringBuilder sb = new StringBuilder();
3568
      
3569
      if (getText() != null)
3570
         sb.append(getText());
3567 3571
      
3568 3572
      // append the token type as a name
3569 3573
      sb.append(" [").append(getSymbolicTokenType()).append("] ");
src/com/goldencode/p2j/convert/ExpressionConversionWorker.java 2022-02-11 15:26:27 +0000
222 222
**     HC  20210401          Made isNumericType and isDateType part of the library.
223 223
**     GES 20210610          Added KW_WID_HAND.
224 224
**     HC  20211001          Implementation of i18n support.
225
**     ME  20211028          Added the POLY 'virtual' data type.
225 226
**     AL2 20211104          DB_REF_NON_STATIC generates case insensitive values.
226 227
**     CA  20211214          The AST manager plugin must be context-local, for runtime conversion, as the 
227 228
**                           InMemoryRegistryPlugin is not thread-safe.
......
1969 1970
               case KW_RET_VAL:
1970 1971
                  jcls = "BaseDataType";
1971 1972
                  break;
1972
                  
1973
               
1973 1974
               // unexpected *_POLY node, error out here
1974 1975
               default:
1975
                  if (oldtype == OO_METH_CLASS && source.getText().equalsIgnoreCase("invoke"))
1976
                  {
1977
                     String defClass = (String) source.getAnnotation("found-in-cls");
1978
                     if ("Progress.Lang.Class".equalsIgnoreCase(defClass) || 
1979
                         "progress.reflect.method".equalsIgnoreCase(defClass))
1980
                     {
1981
                        jcls = "BaseDataType";
1982
                     }
1983
                     break;
1984
                  }
1985
                  errmsg = "Unknown " + source.lookupTokenName(type) + 
1986
                           " with oldtype of " + source.lookupTokenName(oldtype);
1976
                  if (type == OO_METH_POLY) 
1977
                  {
1978
                     jcls = "BaseDataType";
1979
                  }
1980
                  else 
1981
                  {
1982
                     errmsg = "Unknown " + source.lookupTokenName(type) + 
1983
                              " with oldtype of " + source.lookupTokenName(oldtype);
1984
                  }
1987 1985
            }
1988 1986
            break;
1989 1987
         
......
2618 2616
         case KW_MEMPTR:
2619 2617
            jcls  = "memptr";
2620 2618
            break;
2619
         
2620
         case VAR_POLY:
2621
         case FUNC_POLY:
2622
         case ATTR_POLY:
2623
         case METH_POLY:
2624
         case OO_METH_POLY:
2625
         case KW_POLY:
2626
            jcls  = "Object";
2627
            break;
2621 2628
            
2622 2629
         case METH_VOID:
2623 2630
         case OO_METH_VOID:
src/com/goldencode/p2j/oo/core/Assert.java 2021-10-13 13:26:10 +0000
14 14
** 004 CA  20191024 Added method support levels and updated the class support level.
15 15
** 005 ME  20201023 Added implementation for isType, notType.
16 16
**     ME  20210916 Delegate to AssertObject as needed.
17
**     ME  20210930 Remove use of Apache StringUtils.
17 18
*/
18 19

  
19 20
/*
......
84 85
import static com.goldencode.p2j.util.TextOps.*;
85 86
import static com.goldencode.p2j.util.ErrorManager.silent;
86 87

  
87
import org.apache.commons.lang3.*;
88

  
89 88
/**
90 89
 * Business logic (converted to Java from the 4GL source code in
91 90
 * OpenEdge/Core/Assert.cls).
......
567 566
      internalProcedure(Assert.class, "IsEmpty", new Block((Body) () -> {
568 567
         notNull(_p1, _p2);
569 568
         
570
         if (!StringUtils.isEmpty(_p1.getValue()))
569
         if (!TextOps.isEmpty(_p1))
571 570
            returnError(ObjectOps.newInstance(AssertionFailedError.class, "II",
572 571
                     substitute("&1 must be empty", _p2), 0));
573 572
      }));
......
1764 1763
   public static void notEmpty(final longchar _p1, final character _p2)
1765 1764
   {
1766 1765
      internalProcedure(Assert.class, "NotEmpty", new Block((Body) () -> {
1767
         if (!_p1.isUnknown() && StringUtils.isEmpty(_p1.getValue()))
1766
         if (!_p1.isUnknown() && TextOps.isEmpty(_p1))
1768 1767
            returnError(ObjectOps.newInstance(AssertionFailedError.class, "II",
1769 1768
                     substitute("&1 cannot be empty", _p2), 0));
1770 1769
      }));
......
1783 1782
      character p2 = TypeFactory.initInput(_p2);
1784 1783
      
1785 1784
      internalProcedure(Assert.class, "NotEmpty", new Block((Body) () -> {
1786
         if (StringUtils.isEmpty(p1.getValue()))
1785
         if (TextOps.isEmpty(p1))
1787 1786
            returnError(ObjectOps.newInstance(AssertionFailedError.class, "II",
1788 1787
                     substitute("&1 cannot be empty", p2), 0));
1789 1788
      }));
src/com/goldencode/p2j/oo/core/ByteBucket.java 2022-02-11 15:26:27 +0000
120 120
    */
121 121
   public void __core_ByteBucket_execute__()
122 122
   {
123
      externalProcedure(ByteBucket.this, new Block((Body) () -> {
123
      externalProcedure(ByteBucket.class, ByteBucket.this, new Block((Body) () -> {
124 124
         onBlockLevel(Condition.ERROR, Action.THROW);
125 125
         {
126 126
         }
......
168 168
   {
169 169
      int64 var = TypeFactory.initInput(_var);
170 170

  
171
      internalProcedure(this, "Position", new Block((Body) () -> {
171
      internalProcedure(ByteBucket.class, this, "Position", new Block((Body) () -> {
172 172
         position.assign(var);
173 173
      }));
174 174
   }
......
213 213
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
214 214
   public void __core_ByteBucket_constructor__()
215 215
   {
216
      internalProcedure(this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
216
      internalProcedure(ByteBucket.class, this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
217 217
         __core_ByteBucket_constructor__(new int64(0));
218 218
      }));
219 219
   }
......
231 231
   {
232 232
      int64 defaultCapacity = TypeFactory.initInput(_defaultCapacity);
233 233
      
234
      internalProcedure(this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
234
      internalProcedure(ByteBucket.class, this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
235 235
         __lang_BaseObject_constructor__();
236 236

  
237 237
         // just throw a 'matching' error for now until implementation is using the new MemoryOutputStream
......
272 272

  
273 273
      integer initialSize = TypeFactory.initInput(_initialSize);
274 274

  
275
      internalProcedure(this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
275
      internalProcedure(ByteBucket.class, this, "__core_ByteBucket_constructor__", new Block((Body) () -> {
276 276
         __core_ByteBucket_constructor__();
277 277

  
278 278
         Assert.isPositive(initialSize, new character("Initial size"));
......
305 305
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
306 306
   public void __core_ByteBucket_destructor__()
307 307
   {
308
      internalProcedure(this, "__core_ByteBucket_destructor__", new Block((Body) () -> {
308
      internalProcedure(ByteBucket.class, this, "__core_ByteBucket_destructor__", new Block((Body) () -> {
309 309
         destroy();
310 310
      }));
311 311
   }
......
318 318
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
319 319
   public void clear_()
320 320
   {
321
      internalProcedure(this, "Clear", new Block((Body) () -> {
321
      internalProcedure(ByteBucket.class, this, "Clear", new Block((Body) () -> {
322 322
         this.position.assign(1);
323 323
         this.size.assign(0);
324 324
      }));
......
332 332
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
333 333
   public void debug()
334 334
   {
335
      internalProcedure(this, "Debug", new Block((Body) () -> {
335
      internalProcedure(ByteBucket.class, this, "Debug", new Block((Body) () -> {
336 336

  
337 337
         String debugPath = String.format("%sbytebucket-memptr-%d.bin", 
338 338
                  EnvironmentOps.getTempDirectory().getValue(), 
......
359 359
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
360 360
   public void destroy()
361 361
   {
362
      internalProcedure(this, "Destroy", new Block((Body) () -> {
362
      internalProcedure(ByteBucket.class, this, "Destroy", new Block((Body) () -> {
363 363
         this.position.assign(1);
364 364
         this.size.setUnknown();
365 365

  
......
472 472
      int64 pos = TypeFactory.initInput(_pos);
473 473
      int64 size = TypeFactory.initInput(_size);
474 474
      object<? extends Memptr> ret = TypeFactory.object(Memptr.class);
475

  
475
      
476 476
      return function(this, "GetBytes", object.class, new Block((Body) () -> {
477 477
         if (getSize().longValue() == 0 || size.getValue() == 0)
478 478
         {
......
481 481
         else
482 482
         {
483 483
            memptr ptr = TypeFactory.memptr();
484
   
485
            try
484

  
485
            try 
486 486
            {
487 487
               ptr.setLength(size);
488 488
   
......
492 492
            }
493 493
            finally
494 494
            {
495
               if (ptr.lengthOf() > 0L)
496
                  ptr.setLength(0L);
495
               ptr.setLength(0L);
497 496
            }
498 497
         }
499
         
498

  
500 499
         returnNormal(ret);
501 500

  
502 501
      }));
......
665 664
         }
666 665
         finally
667 666
         {
668
            if (ptr.lengthOf() > 0L)
669
               ptr.setLength(0L);
667
            ptr.setLength(0L);
670 668
         }
671 669
      }));
672 670
   }
......
679 677
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
680 678
   public void initialize()
681 679
   {
682
      internalProcedure(this, "Initialize", new Block((Body) () -> {
680
      internalProcedure(ByteBucket.class, this, "Initialize", new Block((Body) () -> {
683 681
         clear_();
684 682
      }));
685 683
   }
......
761 759
   {
762 760
      object<? extends ByteBucket> data = TypeFactory.initInput(_data);
763 761

  
764
      internalProcedure(this, "PutBytes", new Block((Body) () -> {
762
      internalProcedure(ByteBucket.class, this, "PutBytes", new Block((Body) () -> {
765 763
         Assert.notNull(data, new character("Input data"));
766 764

  
767 765
         ByteBucket bbucket = data.ref();
......
797 795
      int64 ptr = TypeFactory.initInput(_ptr);
798 796
      int64 size = TypeFactory.initInput(_size);
799 797

  
800
      internalProcedure(this, "PutBytes", new Block((Body) () -> {
798
      internalProcedure(ByteBucket.class, this, "PutBytes", new Block((Body) () -> {
801 799

  
802 800
         if (!size.isUnknown() && size.longValue() == 0L)
803 801
            return;
......
834 832
   {
835 833
      memptr ptr = TypeFactory.initInput(_ptr);
836 834

  
837
      internalProcedure(this, "PutBytes", new Block((Body) () -> {
835
      internalProcedure(ByteBucket.class, this, "PutBytes", new Block((Body) () -> {
838 836
         writeBytes(ptr);
839 837
      }));
840 838
   }
......
851 849
   {
852 850
      object<? extends Memptr> mptr = TypeFactory.initInput(_mptr);
853 851

  
854
      internalProcedure(this, "PutBytes", new Block((Body) () -> {
852
      internalProcedure(ByteBucket.class, this, "PutBytes", new Block((Body) () -> {
855 853
         Assert.notNull(_mptr, new character("Data"));
856 854

  
857 855
         putBytes(mptr.ref().getPointerValue(), mptr.ref().getSize());
......
870 868
   {
871 869
      longchar data = TypeFactory.initInput(_data);
872 870

  
873
      internalProcedure(this, "PutString", new Block((Body) () -> {
871
      internalProcedure(ByteBucket.class, this, "PutString", new Block((Body) () -> {
874 872
         putString(data, new longchar("UTF-8"));
875 873
      }));
876 874
   }
......
907 905
      longchar data = TypeFactory.initInput(_data);
908 906
      character targetCP = TypeFactory.initInput(_targetCP);
909 907

  
910
      internalProcedure(this, "PutString", new Block((Body) () -> {
908
      internalProcedure(ByteBucket.class, this, "PutString", new Block((Body) () -> {
911 909
         if (TextOps.isEmpty(data))
912 910
            return;
913 911

  
......
941 939
   {
942 940
      object<? extends LegacyString> data = TypeFactory.initInput(_data);
943 941

  
944
      internalProcedure(this, "PutString", new Block((Body) () -> {
942
      internalProcedure(ByteBucket.class, this, "PutString", new Block((Body) () -> {
945 943
         Assert.notNull(data, new character("String data"));
946 944
         
947 945
         putString(data.ref().getValue(), new longchar(data.ref().getEncoding()));
......
988 986
   {
989 987
      Assert.isPositive(p, new character("Start position"));
990 988

  
991
      if (CompareOps._isGreaterThan(p, this.getSize())) {
992
         ErrorManager.recordOrThrowError(4391,  "Unable to evaluate expression with UNKNOWN value in argument");
989
      if (CompareOps._isGreaterThan(p, this.getSize()))
990
      {
991
         ErrorManager.recordOrThrowError(4391,
992
                  "Unable to evaluate expression with UNKNOWN value in argument");
993 993
      }
994
      
994

  
995 995
      long pos = p.longValue();
996 996
      long bytesLeft = data.lengthOf();
997 997
      int putAt = 0;
......
999 999
      int offset = (int) ((pos - 1) % MAX_BYTES_PER_ROW);
1000 1000
      int endBucket = (int) ((size.longValue()) / MAX_BYTES_PER_ROW);
1001 1001
      int endOffset = (int) ((size.longValue()) % MAX_BYTES_PER_ROW);
1002
      
1003 1002

  
1004 1003
      for (int i = nbucket; i <= endBucket; i++)
1005 1004
      {
......
1008 1007

  
1009 1008
         if (numBytes > 0)
1010 1009
         {
1011
            data.write(true, Arrays.copyOfRange(bucket, offset, offset + numBytes), putAt,
1012
                     false);
1010
            data.write(true, Arrays.copyOfRange(bucket, offset, offset + numBytes), putAt, false);
1013 1011

  
1014 1012
            offset = 0;
1015 1013
            putAt += numBytes;
1016 1014
            bytesLeft -= numBytes;
1017
            
1015

  
1018 1016
            if (bytesLeft == 0)
1019 1017
               return;
1020 1018
         }
src/com/goldencode/p2j/oo/core/LegacyString.java 2021-10-13 13:32:21 +0000
15 15
**                  signature.
16 16
** 007 ME  20210520 Set hashCode to return the actual string hashCode.
17 17
**     ME  20210902 Return default hashCode if unknown, fix empty static method and isNullOrEmpty to use trim.
18
**     ME  20210929 Fix return value on join/split methods.
18 19
*/
19 20

  
20 21
/*
......
403 404
      object<? extends com.goldencode.p2j.oo.core.collections.Array> p1 = TypeFactory
404 405
               .initInput(_p1);
405 406
      character p2 = TypeFactory.initInput(_p2);
407
      object<? extends LegacyString> poRet = TypeFactory.object(LegacyString.class);
406 408

  
407
      return function(LegacyString.class, "Join", object.class, new Block((Body) () ->
408
      {
409
      return function(LegacyString.class, "Join", object.class, new Block((Body) () -> {
409 410
         object<? extends LegacyClass> clsString = ObjectOps.getLegacyClass(LegacyString.class);
410
         // remove the assert to fix the OE BUG
411
         Assert.isType(p1, clsString);
412 411

  
413
         if (p2.isUnknown() || p1.isUnknown())
414
         {
415
            returnNormal(new longchar());
416
         }
417
         else
412
         if (!p2.isUnknown() && !p1.isUnknown())
418 413
         {
419 414
            List<String> entries = new ArrayList<String>();
415
            boolean hasUnknown = false;
420 416

  
421 417
            for (int i = 1; i <= p1.ref().getSize().intValue(); i++)
422 418
            {
423 419
               object<? extends _BaseObject_> c = p1.ref().getValue(new integer(i));
424 420
               if (c.isUnknown())
425 421
               {
426
                  returnNormal(new longchar());
427
                  return;
422
                  hasUnknown = true;
423
                  break;
428 424
               }
429 425

  
430 426
               Assert.isType(c, clsString);
......
432 428
               entries.add(ObjectOps.cast(c, LegacyString.class).ref().getValue().getValue());
433 429
            }
434 430

  
435
            String join = entries.stream().collect(Collectors.joining(p2.getValue()));
436

  
437
            returnNormal(ObjectOps.newInstance(LegacyString.class, "I", join));
431
            if (!hasUnknown) {
432
               String join = entries.stream().collect(Collectors.joining(p2.getValue()));
433
   
434
               poRet.assign(ObjectOps.newInstance(LegacyString.class, "I", join));
435
            }
438 436
         }
439 437

  
438
         returnNormal(poRet);
439

  
440 440
      }));
441 441
   }
442 442

  
......
485 485
   {
486 486
      object<? extends com.goldencode.p2j.oo.core.LegacyString>[] p1 = TypeFactory.initInput(_p1);
487 487
      character p2 = TypeFactory.initInput(_p2);
488

  
488
      object<? extends LegacyString> poRet = TypeFactory.object(LegacyString.class);
489
      
489 490
      return function(LegacyString.class, "Join", object.class, new Block((Body) () -> {
490 491
         // indeterminate array or null delimiter 
491
         if (p1.length == 0 || p2.isUnknown())
492
         {
493
            returnNormal(ObjectOps.newInstance(LegacyString.class, "I", new longchar()));
494
         }
495
         else
496
         {
492
         if (p1.length > 0 && !p2.isUnknown())
493
         {
494
            boolean hasUnknown = false;
495
            
497 496
            for (object<? extends com.goldencode.p2j.oo.core.LegacyString> s : p1)
498 497
            {
499 498
               // OE does not check for valid objects in array (will throw error)
500 499
               // if any of the strings has a null value the result is always null
501 500
               if (!s.isUnknown() && s.ref().getValue().isUnknown())
502 501
               {
503
                  returnNormal(ObjectOps.newInstance(LegacyString.class, "I", new longchar()));
504
                  return;
502
                  hasUnknown = true;
503
                  break;
505 504
               }
506 505
            }
507 506

  
508
            returnNormal(ObjectOps.newInstance(LegacyString.class, "I",
509
                     Arrays.stream(p1).map(s -> s.ref().getValue().getValue())
507
            poRet.assign(ObjectOps.newInstance(LegacyString.class, "I",
508
                        hasUnknown ? new character() : Arrays.stream(p1).map(s -> s.ref().getValue().getValue())
510 509
                              .collect(Collectors.joining(p2.getValue()))));
511 510
         }
511
         else 
512
         {
513
            poRet.assign(ObjectOps.newInstance(LegacyString.class, "I", new character("")));
514
         }
515
            
516
         
517
         returnNormal(poRet);
512 518
      }));
513 519
   }
514 520

  
......
628 634
   {
629 635
      object<? extends com.goldencode.p2j.oo.core.LegacyString> p1 = TypeFactory.initInput(_p1);
630 636
      character p2 = TypeFactory.initInput(_p2);
637
      object<? extends com.goldencode.p2j.oo.core.collections.Array> poRet = TypeFactory
638
               .object(com.goldencode.p2j.oo.core.collections.Array.class);
631 639

  
632
      return function(LegacyString.class, "Split", object.class, new Block((Body) () ->
633
      {
640
      return function(LegacyString.class, "Split", object.class, new Block((Body) () -> {
634 641

  
635 642
         if (!p1.isUnknown() && (p2.isUnknown() || p1.ref().getValue().isUnknown()))
636 643
         {
637 644
            // num-entries is unknown, this will throw assert error
638
            returnNormal(ObjectOps.newInstance(com.goldencode.p2j.oo.core.collections.Array.class,
645
            poRet.assign(ObjectOps.newInstance(com.goldencode.p2j.oo.core.collections.Array.class,
639 646
                     "I", new integer()));
640 647
         }
641 648
         else
642 649
         {
643 650
            // 4GL does not test the string object, 3135 system error will be thrown if null
644 651
            String[] entries = TextOps.entries(p1.ref().getValue().getValue(), p2.getValue());
645
            object<? extends com.goldencode.p2j.oo.core.collections.Array> outputArray = ObjectOps
646
                     .newInstance(com.goldencode.p2j.oo.core.collections.Array.class, "I",
647
                              entries.length);
652
            poRet.assign(ObjectOps.newInstance(com.goldencode.p2j.oo.core.collections.Array.class,
653
                     "I", entries.length));
648 654

  
649 655
            for (int i = 0; i < entries.length; i++)
650 656
            {
651
               outputArray.ref().setValue(ObjectOps
652
                        .newInstance(com.goldencode.p2j.oo.core.LegacyString.class, "I", entries[i]), new integer(i + 1));
657
               poRet.ref()
658
                        .setValue(ObjectOps.newInstance(
659
                                 com.goldencode.p2j.oo.core.LegacyString.class, "I", entries[i]),
660
                                 new integer(i + 1));
653 661
            }
654
            
655
            returnNormal(outputArray);
662

  
656 663
         }
657 664

  
665
         returnNormal(poRet);
658 666
      }));
659 667
   }
660 668

  
src/com/goldencode/p2j/oo/core/WidgetHandle.java 2021-10-01 10:52:07 +0000
10 10
** 003 CA  20191024 Added method support levels and updated the class support level.
11 11
** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
12 12
**                  signature.
13
**     ME  20211001 Fix toString method, returns unknown if invalid handle.
13 14
*/
14 15

  
15 16
/*
......
236 237
   {
237 238
      return function(this, "ToString", character.class, new Block((Body) () ->
238 239
      {
239
         returnNormal(this.value.toStringMessage());
240
         returnNormal(character.valueOf(this.value));
240 241
      }));
241 242
   }
242 243
}
src/com/goldencode/p2j/oo/core/collections/AbstractTtcollection.java 2021-09-28 08:33:36 +0000
13 13
**                  signature.
14 14
**     CA  20210609 Updated INPUT/INPUT-OUTPUT parameters to the new approach, where they are explicitly 
15 15
**                  initialized at the method's execution, and not at the caller's arguments.
16
**     ME  20210928 Fix return value on clone method, defined out of the function block.
16 17
*/
17 18

  
18 19
/*
......
459 460
   @Override
460 461
   public object<? extends com.goldencode.p2j.oo.lang._BaseObject_> clone()
461 462
   {
463
      object<? extends Icollection> clone = TypeFactory.object(Icollection.class);
464
      
462 465
      return function(this, "Clone", object.class, new Block((Body) () -> {
463
         object<? extends AbstractTtcollection> clone = ObjectOps.newInstance(getClass());
466
         clone.assign(ObjectOps.newInstance(getClass()));
464 467
         cloneElements(clone);
465 468
         returnNormal(clone);
466 469
      }));
src/com/goldencode/p2j/oo/core/collections/Array.java 2021-10-13 13:43:50 +0000
14 14
**         20210113 Renamed clear() to clear_(), to follow NameConverter's rules.
15 15
** 006 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
16 16
**                  signature.
17
**     ME  20210916 Fix wrong method call on set (increment instead of decrement)
17
**     ME  20210916 Fix wrong method call on set (increment instead of decrement). Clean-up resize
18
**                  and fix 'retainAll' method.
19
**     ME  20210929 Fix clone return value.
18 20
*/
19 21

  
20 22
/*
......
197 199
   {
198 200
      integer newSize = TypeFactory.initInput(_newSize);
199 201
      internalProcedure(this, "Size", new Block((Body) () -> {
200
         this.setArraySize(newSize.isUnknown() ? 0 : newSize.intValue());
202
         if (newSize.isUnknown())
203
         {
204
            if (!discardOnShrink.booleanValue())
205
            {
206
               undoThrowTopLevel(ObjectOps.newInstance(ResizeError.class, "II",
207
                        new character("Array"), new character("smaller")));
208
            }
209

  
210
            value = ArrayAssigner.resize(value, newSize);
211
         }
212
         else
213
         {
214
            integer initSize = getSize();
215

  
216
            if (!CompareOps._isEqual(initSize, newSize))
217
            {
218
               if (initSize.isUnknown())
219
               {
220
                  value = ArrayAssigner.resize(value, newSize);
221
               }
222
               else
223
               {
224
                  if (CompareOps._isLessThan(newSize, initSize) && !discardOnShrink.booleanValue())
225
                     undoThrowTopLevel(ObjectOps.newInstance(ResizeError.class, "II",
226
                              new character("Array"), new character("smaller")));
227
                  
228
                  object<? extends com.goldencode.p2j.oo.lang._BaseObject_>[] tmpValue = TypeFactory
229
                           .objectExtent(initSize.intValue(), BaseObject.class);
230

  
231
                  tmpValue = (object<? extends _BaseObject_>[]) ArrayAssigner.assignMulti(tmpValue,
232
                           value);
233

  
234
                  value = ArrayAssigner.resize(value, new integer());
235
                  value = ArrayAssigner.resize(value, newSize);
236

  
237
                  for (int i = 0; i < initSize.intValue(); i++)
238
                  {
239
                     value[i] = tmpValue[i];
240
                  }
241
               }
242
            }
243
         }
201 244
      }));
202 245
   }
203 246

  
......
292 335

  
293 336
      return function(this, "AddArray", logical.class, new Block((Body) () -> {
294 337
         // OE bug, no check if extent is unknown - size is set to unknown
295

  
296
         setArraySize(
297
                  p1.length == 0 || getSize().isUnknown() ? 0 : p1.length + getSize().intValue());
298

  
299
         for (int i = 1; i <= p1.length; i++)
338
         if (p1.length > 0) 
300 339
         {
301
            // incrementing an unknown is always unknown
302
            setValue(p1[i - 1], getSize().isUnknown() ? new integer()
303
                     : new integer(getSize().intValue() + i));
340
            integer size = getSize();
341
            
342
            setSize(new integer(p1.length + size.getValue()));
343
   
344
            for (int i = 1; i <= p1.length; i++)
345
            {
346
               setValue(p1[i - 1], new integer(size.getValue() + i));
347
            }
304 348
         }
305

  
306 349
         returnNormal(true);
307 350
      }));
308 351
   }
......
312 355
   public void clear_()
313 356
   {
314 357
      internalProcedure(this, "Clear", new Block((Body) () -> {
315
         setArraySize(0);
358
         setSize(new integer());
316 359
      }));
317 360
   }
318 361

  
......
320 363
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
321 364
   public object<? extends com.goldencode.p2j.oo.lang._BaseObject_> clone()
322 365
   {
366
      object<? extends Icollection> clone = TypeFactory.object(Icollection.class);
367
      
323 368
      return function(this, "Clone", object.class, new Block((Body) () -> {
324
         object<? extends Array> clone = ObjectOps.newInstance(getClass());
369
         clone.assign(ObjectOps.newInstance(getClass()));
325 370

  
326 371
         cloneElements(clone);
327 372

  
......
445 490

  
446 491
         for (int i = 1; i <= value.length; i++)
447 492
         {
448
            if (!value[i].ref().legacyEquals(p1).booleanValue())
493
            object<? extends _BaseObject_> obj = ArrayAssigner.subscript(this.value, i);
494
            if (obj.ref().legacyEquals(p1).booleanValue())
449 495
            {
450 496
               // decrement reference to object
451
               ObjectOps.decrement(value[i].ref());
497
               ObjectOps.decrement(obj.ref());
452 498

  
453 499
               // set it to invalid
454
               value[i] = new object<>();
500
               ArrayAssigner.assignSingle(this.value, i, new object<>());
455 501
               returnNormal(new logical(true));
456 502
            }
457 503
         }
......
472 518
      return function(this, "RemoveAll", logical.class, new Block((Body) () -> {
473 519
         boolean lAny = false;
474 520

  
475
         object<? extends Iiterator> iterator = iterator();
521
         object<? extends Iiterator> iterator = p1.ref().iterator();
476 522

  
477 523
         while (iterator.ref().hasNext().booleanValue())
478 524
         {
......
513 559
      }));
514 560
   }
515 561

  
516
   private void setArraySize(final int newSize)
517
   {
518
      if (newSize == 0)
519
      {
520
         if (!discardOnShrink.booleanValue())
521
         {
522
            undoThrowTopLevel(ObjectOps.newInstance(ResizeError.class, "II",
523
                     new character("Array"), new character("smaller")));
524
         }
525

  
526
         value = ArrayAssigner.resize(value, new integer());
527
      }
528
      else
529
      {
530
         integer initSize = getSize();
531

  
532
         if (initSize.isUnknown() || newSize != initSize.intValue())
533
         {
534
            if (initSize.isUnknown())
535
            {
536
               value = ArrayAssigner.resize(value, newSize);
537
            }
538
            else
539
            {
540
               if (newSize < initSize.intValue() && !discardOnShrink.booleanValue())
541
                  undoThrowTopLevel(ObjectOps.newInstance(ResizeError.class, "II",
542
                           new character("Array"), new character("smaller")));
543
               
544
               object<? extends com.goldencode.p2j.oo.lang._BaseObject_>[] tmpValue = TypeFactory
545
                        .objectExtent(initSize.intValue(), BaseObject.class);
546

  
547
               tmpValue = (object<? extends _BaseObject_>[]) ArrayAssigner.assignMulti(tmpValue,
548
                        value);
549

  
550
               value = ArrayAssigner.resize(value, new integer());
551
               value = ArrayAssigner.resize(value, newSize);
552

  
553
               for (int i = 0; i < initSize.intValue(); i++)
554
               {
555
                  value[i] = tmpValue[i];
556
               }
557
            }
558
         }
559
      }
560
   }
561

  
562 562
   @LegacySignature(type = Type.METHOD, name = "SetValue", parameters = {
563 563
            @LegacyParameter(name = "p1", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT") })
564 564
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
565 565
   public void setValue(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _p1)
566 566
   {
567 567
      internalProcedure(this, "SetValue", new Block((Body) () -> {
568
         setValue(_p1, getSize().isUnknown() ? getSize() : new integer(getSize().intValue() + 1));
568
         setValue(_p1, getSize().isUnknown() ? getSize() : new integer(MathOps.plus(getSize(), 1)));
569 569
      }));
570 570
   }
571 571

  
......
581 581

  
582 582
      internalProcedure(this, "SetValue", new Block((Body) () -> {
583 583

  
584
         if (!p2.isUnknown() && !getSize().isUnknown() && p2.intValue() > getSize().intValue())
584
         if (CompareOps._isGreaterThan(p2, getSize()))
585 585
         {
586 586
            if (autoExpand.booleanValue())
587 587
            {
588
               setArraySize(p2.intValue() + (int) Math.round(getSize().intValue() * 0.5));
588
               setSize(new integer(MathOps.plus(p2, MathOps.round(MathOps.multiply(getSize(), 0.5), 0))));
589 589
            }
590 590
            else
591 591
            {
......
596 596
         }
597 597

  
598 598
         // decrement reference to previous object if any
599
         if (!value[p2.intValue() - 1].isUnknown())
600
            ObjectOps.decrement(value[p2.intValue() - 1].ref());
599
         object<? extends _BaseObject_> obj = ArrayAssigner.subscript(value, p2);
600
         
601
         if (!obj.isUnknown())
602
            ObjectOps.decrement(obj.ref());
601 603

  
602 604
         ArrayAssigner.assignSingle(value, p2, p1);
603 605

  
604 606
         // increment reference to object
605
         ObjectOps.increment(p1.ref());
607
         if (!p1.isUnknown())
608
            ObjectOps.increment(p1.ref());
606 609
      }));
607 610
   }
608 611

  
src/com/goldencode/p2j/oo/core/collections/ArrayIterator.java 2021-09-28 07:53:08 +0000
9 9
** 002 CA  20210113 Renamed Iiterator.next to Iiterator.next_, to follow NameConverter's rules.
10 10
** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
11 11
**                  signature.
12
** 004 ME  20210927 Use '4GL' compare to account for unknown values.
12 13
*/
13 14

  
14 15
/*
......
173 174
   {
174 175
      return function(ArrayIterator.class, this, "HasNext", logical.class, new Block((Body) () ->
175 176
      {
176
         returnNormal(currentExtent.intValue() < iteratedArray.ref().getSize().intValue());
177
         returnNormal(CompareOps.lessThan(currentExtent, iteratedArray.ref().getSize()));
177 178
      }));
178 179
   }
179 180

  
......
183 184
   {
184 185
      return function(ArrayIterator.class, this, "Next", object.class, new Block((Body) () ->
185 186
      {
186
         currentExtent.assign(currentExtent.intValue() + 1);
187
         currentExtent.assign(MathOps.plus(currentExtent, 1));
187 188
         returnNormal(iteratedArray.ref().getValue(currentExtent));
188 189
      }));
189 190
   }
src/com/goldencode/p2j/oo/core/collections/LegacyMap.java 2022-02-11 15:26:27 +0000
14 14
** 004 ME  20210325 Increment/decrement object references (key/value) when added/removed.
15 15
**     ME  20210521 Use a 'key' object with hashCode/equals overrides.
16 16
**     ME  20210902 Do not decrement reference for input parameter on remove.
17
**     ME  20210929 Fix return object on get/put/remove.
17 18
*/
18 19

  
19 20
/*
......
314 315
   {
315 316
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poKey = TypeFactory
316 317
               .initInput(_poKey);
317

  
318
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poRet = TypeFactory.object(_BaseObject_.class);
319
      
318 320
      return function(LegacyMap.class, this, "Get", object.class, new Block((Body) () ->
319 321
      {
320 322
         keyobject key = new keyobject(poKey);
321 323
         
322 324
         if (map.containsKey(key))
323
            returnNormal(map.get(key));
325
            poRet.assign(map.get(key));
324 326

  
325
         returnNormal(new object());
327
         returnNormal(poRet);
326 328
      }));
327 329
   }
328 330

  
......
338 340
               .initInput(_poKey);
339 341
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poValue = TypeFactory
340 342
               .initInput(_poValue);
341

  
343
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poRet = TypeFactory.object(_BaseObject_.class);
344
      
342 345
      return function(LegacyMap.class, this, "Put", object.class, new Block((Body) () ->
343 346
      {
344 347
         if (poKey.ref().equals(this))
345 348
            undoThrow(AppError.newInstance(new character("A Map cannot have itself as key.")));
346 349

  
347
         if (poValue._isValid())
350
         if (!poValue.isUnknown())
348 351
         {
349 352
            ObjectOps.increment(poValue.ref());
350 353
         }
351 354
         
352
         object obj = map.put(new keyobject(poKey), poValue);
353

  
354
         if (obj == null) 
355
         poRet.assign(map.put(new keyobject(poKey), poValue));
356
         
357
         if (!poRet.isUnknown()) 
358
         {
359
            ObjectOps.decrement(poRet.ref());
360
         }
361
         else 
355 362
         {
356 363
            ObjectOps.increment(poKey.ref());
357 364
            size++;
358 365
         }
359 366
         
360
         returnNormal(obj != null ? obj : new object());
367
         returnNormal(poRet);
361 368
      }));
362 369
   }
363 370

  
......
388 395
   {
389 396
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poKey = TypeFactory
390 397
               .initInput(_poKey);
391

  
398
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> poRet = TypeFactory.object(_BaseObject_.class);
399
      
392 400
      return function(LegacyMap.class, this, "Remove", object.class, new Block((Body) () ->
393 401
      {
394 402
         if (!poKey.isValid().booleanValue())
395 403
            returnNormal(new object());
396 404

  
397
         object obj = map.remove(poKey);
398
         
399
         if (obj != null && obj._isValid())
400
            ObjectOps.decrement(obj.ref());
401
         
402
         if (obj != null)
405
         poRet.assign(map.remove(new keyobject(poKey)));
406
         
407
         if (!poRet.isUnknown())
408
         {
409
            ObjectOps.decrement(poRet.ref());
403 410
            size--;
411
         	
412
            if (!map.containsKey(poKey))
413
            {
414
               ObjectOps.decrement(poKey.ref());
415
            }
416
         }
404 417
         
405
         returnNormal(obj != null ? obj : new object());
418
         returnNormal(poRet);
406 419
      }));
407 420
   }
408 421

  
src/com/goldencode/p2j/oo/io/FileInputStream.java 2021-10-13 13:43:50 +0000
12 12
**     ME   20210204 Complete implementation as of OE12.2.
13 13
** 005 CA   20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
14 14
**                   signature.
15
**     CA  20210609 Updated INPUT/INPUT-OUTPUT parameters to the new approach, where they are explicitly 
16
**                  initialized at the method's execution, and not at the caller's arguments.
15
**     CA   20210609 Updated INPUT/INPUT-OUTPUT parameters to the new approach, where they are explicitly 
16
**                   initialized at the method's execution, and not at the caller's arguments.
17
**     ME   20211001 Do not attempt to open the stream in ctor, delay it till read/skip is used.
17 18
*/
18 19

  
19 20
/*
......
132 133
         
133 134
         this.fileName.assign(filename);
134 135
         
135
         try
136
         {
137
            sFileStream.assign(StreamFactory.openFileStream((filename).toStringMessage(), false, false));
138
            sFileStream.setBinary();
139
            sFileStream.setConvert(false);
140
            
141
            FileSystemOps.initFileInfo(fileName);
142
            fileSize = FileSystemOps.fileInfoGetSize().longValue();
143
            bytesLeft = fileSize;
144
         }
145
         catch (Exception e)
146
         {
147
            undoThrow(SysError.newInstance("Cannot find or open file %s, errno = 2", 11294, true, false));
148
         } 
149
         
150 136
      }));
151 137
   }
152 138
   
......
167 153
   {
168 154
      internalProcedure(FileInputStream.class, this, "Close", new Block((Body) () -> 
169 155
      {
170
         sFileStream.closeIn();
156
         if(sFileStream.isValid())
157
            sFileStream.closeIn();
158
         
171 159
         super.close();
172 160
      }));
173 161
   }
......
262 250
            undoThrow(SysError.newInstance("Invalid value specified for parameter 'length' of method or constructor 'Read'", 18193, false, true));
263 251
         }
264 252
         
253
         _checkOpen();
254
         
265 255
         long toRead = bytesLeft;
266 256
         
267 257
         if (bytesLeft > 0)
......
328 318
         undoThrow(SysError.newInstance("Cannot invoke Read method in 'Progress.IO.FileInputStream' because it is not implemented", 18192, false, false));
329 319
      }));
330 320
   }
321
   
322
   private void _checkOpen () {
323
      if (!sFileStream.isValid()) 
324
      {
325
         try
326
         {
327
            sFileStream.assign(StreamFactory.openFileStream((fileName).toStringMessage(), false, false));
328
            sFileStream.setBinary();
329
            sFileStream.setConvert(false);
330
            
331
            FileSystemOps.initFileInfo(fileName);
332
            fileSize = FileSystemOps.fileInfoGetSize().longValue();
333
            bytesLeft = fileSize;
334
         }
335
         catch (Exception e)
336
         {
337
            undoThrow(SysError.newInstance("Cannot find or open file %s, errno = 2", 11294, true, false));
338
         }
339
      }
340
   }
331 341
}
src/com/goldencode/p2j/oo/json/objectmodel/JsonObject.java 2022-02-11 15:26:27 +0000
24 24
**     CA  20210816 Fixed clone() - object references must be incremented.
25 25
**     OM  20210825 getJsonDataTypeName() is static now.
26 26
**     VVT 20210917 Javadoc fixed. 
27
**     ME  20210929 Fix return value on clone method.
27 28
*/
28 29

  
29 30
/*
......
513 514
   @Override
514 515
   public object<? extends com.goldencode.p2j.oo.lang._BaseObject_> clone()
515 516
   {
517
      object<JsonObject> cloned = TypeFactory.object(JsonObject.class);
518
      
516 519
      return function(this, "Clone", object.class, new Block((Body) () ->
517 520
      {
518
         object<JsonObject> cloned = ObjectOps.newInstance(JsonObject.class);
521
         cloned.assign(ObjectOps.newInstance(JsonObject.class));
522
         
519 523
         for (Map.Entry<String, Object> prop : properties.entrySet())
520 524
         {
521 525
            Object val = prop.getValue();
src/com/goldencode/p2j/oo/json/objectmodel/ObjectModelParser.java 2022-02-11 15:26:27 +0000
14 14
** 007 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
15 15
**     OM  20210329 FIX-CODEPAGE is emitted as static method call to accomodate dereferenciation cases.
16 16
**     CA  20210709 JSON parse must use a pristine byte stream and use the reader to decode it.
17
**     ME  20210929 Fix return value on parse methods.
17 18
**     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
18 19
**                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
19 20
**                  be tracked.
......
254 255
         }
255 256
         
256 257
         // empty string does not throw as for character/longchar so parse the string directly
257
         
258 258
         try
259 259
         {
260 260
            res.assign(JsonBackend.instance().parse(source.getString(1).toStringMessage()));
src/com/goldencode/p2j/oo/lang/LegacyClass.java 2021-10-28 07:59:30 +0000
22 22
**     GES 20200605 Fixed isValidEnum() processing.
23 23
** 009 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
24 24
**     OM  20210225 Dropped duplicated error code.
25
**     ME  20211028 Use 'POLY' data type for return/parameter on invoke/getPropertyValue/setPropertyValue.
25 26
*/
26 27

  
27 28
/*
......
143 144
    * 
144 145
    * @return   See above.
145 146
    */
146
   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", parameters = 
147
   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", returns = "BDT", parameters = 
147 148
   {
148 149
      @LegacyParameter(name = "propName", type = "CHARACTER", mode = "INPUT")
149 150
   })
......
165 166
    * 
166 167
    * @return   See above.
167 168
    */
168
   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", parameters = 
169
   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", returns = "BDT", parameters = 
169 170
   {
170 171
      @LegacyParameter(name = "propName", type = "CHARACTER", mode = "INPUT"),
171
      @LegacyParameter(name = "idx", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
172
      @LegacyParameter(name = "idx", type = "BDT", mode = "INPUT")
172 173
   })
173 174
   @LegacyResourceSupport(supportLvl = CVT_LVL_PARTIAL|RT_LVL_STUB)
174
   public Object getPropertyValue(character propName, object<? extends BaseObject> idx)
175
   public Object getPropertyValue(character propName, Object idx)
175 176
   {
176 177
      // TODO:
177 178
      return new unknown();
......
187 188
    * 
188 189
    * @return   See above.
189 190
    */
190
   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", parameters = 
191
   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", returns = "BDT", parameters = 
191 192
   {
192 193
      @LegacyParameter(name = "instance", type = "OBJECT", qualified = "Progress.Lang.Object", mode = "INPUT"),
193 194
      @LegacyParameter(name = "propName", type = "CHARACTER", mode = "INPUT"),
......
212 213
    * 
213 214
    * @return   See above.
214 215
    */
215
   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", parameters = 
216
   @LegacySignature(type = Type.METHOD, name = "GetPropertyValue", returns = "BDT", parameters = 
216 217
   {
217 218
      @LegacyParameter(name = "instance", type = "OBJECT", qualified = "Progress.Lang.Object", mode = "INPUT"),
218 219
      @LegacyParameter(name = "propName", type = "CHARACTER", mode = "INPUT"),
219
      @LegacyParameter(name = "idx", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
220
      @LegacyParameter(name = "idx", type = "BDT", mode = "INPUT")
220 221
   })
221 222
   @LegacyResourceSupport(supportLvl = CVT_LVL_PARTIAL|RT_LVL_STUB)
222 223
   public Object getPropertyValue(object<? extends _BaseObject_> instance, 
223 224
                                  character propName, 
224
                                  object<? extends BaseObject> idx)
225
                                  Object idx)
225 226
   {
226 227
      // TODO:
227 228
      return new unknown();
228 229
   }
229

  
230
   
230 231
   /**
231 232
    * Resolve the legacy class from the given name.
232 233
    * 
......
743 744
    *            
744 745
    * @return    Any returned value, or unknown if the method is void.
745 746
    */
746
   @LegacySignature(type = Type.METHOD, name = "invoke", parameters = 
747
   @LegacySignature(type = Type.METHOD, name = "invoke", returns = "BDT", parameters = 
747 748
   {
748 749
      @LegacyParameter(name = "method", type = "CHARACTER", mode = "INPUT")
749 750
   })
......
815 816
    *            
816 817
    * @return    Any returned value, or unknown if the method is void.
817 818
    */
818
   @LegacySignature(type = Type.METHOD, name = "invoke", parameters = 
819
   @LegacySignature(type = Type.METHOD, name = "invoke", returns = "BDT", parameters = 
819 820
   {
820 821
      @LegacyParameter(name = "ref",    type = "OBJECT", mode = "INPUT", qualified = "Progress.Lang.Object"),
821 822
      @LegacyParameter(name = "parms",  type = "OBJECT", mode = "INPUT", qualified = "Progress.Lang.ParameterList")
......
846 847
    *            
847 848
    * @return    Any returned value, or unknown if the method is void.
848 849
    */
849
   @LegacySignature(type = Type.METHOD, name = "invoke", parameters = 
850
   @LegacySignature(type = Type.METHOD, name = "invoke", returns = "BDT", parameters = 
850 851
   {
851 852
      @LegacyParameter(name = "ref",    type = "OBJECT",    mode = "INPUT", qualified = "Progress.Lang.Object"),
852 853
      @LegacyParameter(name = "method", type = "CHARACTER", mode = "INPUT"),
......
869 870
    *            
870 871
    * @return    Any returned value, or unknown if the method is void.
871 872
    */
872
   @LegacySignature(type = Type.METHOD, name = "invoke", parameters = 
873
   @LegacySignature(type = Type.METHOD, name = "invoke", returns = "BDT", parameters = 
873 874
   {
874 875
      @LegacyParameter(name = "ref",    type = "OBJECT",    mode = "INPUT", qualified = "Progress.Lang.Object"),
875 876
      @LegacyParameter(name = "method", type = "CHARACTER", mode = "INPUT"),
......
1272 1273
   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
1273 1274
   {
1274 1275
      @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
1275
      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
1276
   })
1277
   public void setPropertyValue(final character _pname, final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _value)
1278
   {
1279
      character pname = TypeFactory.initInput(_pname);
1280
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> value = TypeFactory.initInput(_value);
1281
      
1282
      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
1283
   }
1284

  
1285
   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
1286
   {
1287
      @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
1288
      @LegacyParameter(name = "index", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
1289
      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
1290
   })
1291
   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)
1292
   {
1293
      character pname = TypeFactory.initInput(_pname);
1294
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> index = TypeFactory.initInput(_index);
1295
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> value = TypeFactory.initInput(_value);
1296
      
1297
      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
1298
   }
1299

  
1300
   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
1301
   {
1302
      @LegacyParameter(name = "obj-ref", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
1303
      @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
1304
      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
1305
   })
1306
   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)
1307
   {
1308
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> objRef = TypeFactory.initInput(_objRef);
1309
      character pname = TypeFactory.initInput(_pname);
1310
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> value = TypeFactory.initInput(_value);
1311
      
1312
      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
1313
   }
1314

  
1315
   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
1316
   {
1317
      @LegacyParameter(name = "obj-ref", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
1318
      @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
1319
      @LegacyParameter(name = "index", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
1320
      @LegacyParameter(name = "value", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT")
1321
   })
1322
   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)
1323
   {
1324
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> objRef = TypeFactory.initInput(_objRef);
1325
      character pname = TypeFactory.initInput(_pname);
1326
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> index = TypeFactory.initInput(_index);
1327
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> value = TypeFactory.initInput(_value);
1328
      
1276
      @LegacyParameter(name = "value", type = "BDT", mode = "INPUT")
1277
   })
1278
   public void setPropertyValue(final character _pname, final Object _value)
1279
   {
1280
      character pname = TypeFactory.initInput(_pname);
1281
      
1282
      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
1283
   }
1284

  
1285
   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = {
1286
            @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
1287
            @LegacyParameter(name = "index", type = "BDT", mode = "INPUT"),
1288
            @LegacyParameter(name = "value", type = "BDT", mode = "INPUT") })
1289
   public void setPropertyValue(final character _pname, final Object _index,
1290
            final Object _value)
1291
   {
1292
      character pname = TypeFactory.initInput(_pname);
1293

  
1294
      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
1295
   }
1296
   
1297
   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = 
1298
   {
1299
      @LegacyParameter(name = "obj-ref", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
1300
      @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
1301
      @LegacyParameter(name = "value", type = "BDT", mode = "INPUT")
1302
   })
1303
   public void setPropertyValue(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _objRef, final character _pname, final Object _value)
1304
   {
1305
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> objRef = TypeFactory.initInput(_objRef);
1306
      character pname = TypeFactory.initInput(_pname);
1307
      
1308
      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
1309
   }
1310

  
1311
   @LegacySignature(type = Type.METHOD, name = "SetPropertyValue", parameters = {
1312
            @LegacyParameter(name = "obj-ref", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"),
1313
            @LegacyParameter(name = "pname", type = "CHARACTER", mode = "INPUT"),
1314
            @LegacyParameter(name = "index", type = "BDT", mode = "INPUT"),
1315
            @LegacyParameter(name = "value", type = "BDT", mode = "INPUT") })
1316
   public void setPropertyValue(
1317
            final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _objRef,
1318
            final character _pname, final Object _index,
1319
            final Object _value)
1320
   {
1321
      object<? extends com.goldencode.p2j.oo.lang._BaseObject_> objRef = TypeFactory
1322
               .initInput(_objRef);
1323
      character pname = TypeFactory.initInput(_pname);
1324

  
1329 1325
      internalProcedure(LegacyClass.class, this, "SetPropertyValue", new Block());
1330 1326
   }
1331 1327
}
src/com/goldencode/p2j/oo/net/MediaLinkEntity.java 2021-10-13 13:43:50 +0000
10 10
** 
11 11
** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
12 12
**                  signature.
13
**     ME  20210929 Fix return object on deserialize, use enum literals in substitute.
13 14
*/
14 15

  
15 16
/*
......
287 288
   {
288 289
      longchar pcMle = TypeFactory.initInput(_pcMle);
289 290
      object<? extends com.goldencode.p2j.oo.core.SerializationFormatEnum> poSerializedAs = TypeFactory.initInput(_poSerializedAs);
291
      object<MediaLinkEntity> mle = TypeFactory.object(MediaLinkEntity.class);
290 292
      
291 293
      return function(MediaLinkEntity.class, "Deserialize", object.class, new Block((Body) () -> 
292 294
      {
......
298 300
         {
299 301
            undoThrow(AppError.newInstance(
300 302
                     TextOps.substitute("Unsupported MLE serialization type &1",
301
                              poSerializedAs),
303
                              poSerializedAs.ref().toLegacyString()),
302 304
                     new integer(0)));
303 305
         }
304 306
         
305
         object<MediaLinkEntity> mle = ObjectOps.newInstance(MediaLinkEntity.class);
307
         mle.assign(ObjectOps.newInstance(MediaLinkEntity.class));
306 308
         
307 309
         object<ObjectModelParser> parser = ObjectOps.newInstance(ObjectModelParser.class);
308 310
         object<JsonObject> jsonObj = ObjectOps.cast(parser.ref().parse(pcMle), JsonObject.class);
... This diff was truncated because it exceeds the maximum size that can be displayed.