Project

General

Profile

Feature #9436

add built-in OO classes

Added by Greg Shah over 1 year ago. Updated about 1 year ago.

Status:
WIP
Priority:
Normal
Assignee:
Paul Bodale
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

support.png (91.7 KB) Constantin Asofiei, 02/12/2025 12:51 PM

ArrayIteratorTests.zip (13.3 KB) Ioana-Cristina Prioteasa, 04/24/2025 07:37 AM

ArrayError.png (12.5 KB) Ioana-Cristina Prioteasa, 04/30/2025 08:46 AM


Related issues

Related to Base Language - Feature #9488: implement all built-in OO classes using the open source ADE code from 12.8.4 WIP
Related to Base Language - Feature #9955: Implement ClientPrincipal:TENANT-ID and ClientPrincipal:TENANT-NAME Test

History

#1 Updated by Greg Shah over 1 year ago

OpenEdge.Core.Collections.ICollection.totable(KW_OUTPUT TABLE-HANDLE) - not all implementations have the 'toTable' method implemented
OpenEdge.Core.Collections.List
OpenEdge.Core.Collections.ObjectStack
Progress.Data.BindingSource
OpenEdge.Core.System.InvalidValueSpecifiedError
progress.util.typehelper
progress.util.resourcemanager
progress.util.enumhelper
openedge.core.collections.listiterator
OpenEdge.Core.TimeStamp.toabldatetimetzfromiso(KW_INPUT character)

#2 Updated by Greg Shah over 1 year ago

  • Related to Feature #9488: implement all built-in OO classes using the open source ADE code from 12.8.4 added

#3 Updated by Constantin Asofiei over 1 year ago

ADE does not have source code for the progress package. These need to be tested and implemented in FWD manually.

The other appear in the ADE project:

./abl/src/corelib/OpenEdge/Core/TimeStamp.cls
./abl/src/corelib/OpenEdge/Core/Collections/List.cls
./abl/src/corelib/OpenEdge/Core/Collections/ListIterator.cls
./abl/src/corelib/OpenEdge/Core/Collections/ICollection.cls
./abl/src/corelib/OpenEdge/Core/Collections/ObjectStack.cls
./abl/src/corelib/OpenEdge/Core/System/InvalidValueSpecifiedError.cls

#4 Updated by Greg Shah over 1 year ago

ADE does not have source code for the progress package.

Yes. See #9488-7.

#5 Updated by Marian Edu over 1 year ago

Just one thing might worth mentioning here, the tests we have for OO is based on 12.2 version, there might be differences when we switch to 12.8. The 'collections' are now implemented in Progress and since they even use generics there (only place that this is possible for now) it's probably just extending corresponding Java collections in Progress package and then convert the ones in OpenEdge since those aren't using temp-tables anymore.

#6 Updated by Constantin Asofiei over 1 year ago

ADE also does not have source code for the Ccs package, in FWD these are the skeleton/oo4gl/Ccs files.

#7 Updated by Constantin Asofiei over 1 year ago

  • File support.png added
  • Assignee set to Ioana-Cristina Prioteasa

Greg, in this task we can track the non-ADE .cls implementation (i.e. what is not covered by #9488).

For the first stage, we need to implement the missing progress or ccs classes - double-check the support for these:
./skeleton/oo4gl/Ccs/Common/Support/IInt64Holder.cls
./skeleton/oo4gl/Progress/Data/BindingSource.cls
./skeleton/oo4gl/Progress/Json/ObjectModel/JsonArray.cls
./skeleton/oo4gl/Progress/Json/ObjectModel/JsonConstruct.cls
./skeleton/oo4gl/Progress/Json/ObjectModel/JsonObject.cls
./skeleton/oo4gl/Progress/Json/ObjectModel/ObjectModelParser.cls
./skeleton/oo4gl/Progress/Lang/AppError.cls
./skeleton/oo4gl/Progress/Lang/Class.cls
./skeleton/oo4gl/Progress/Lang/Enum.cls
./skeleton/oo4gl/Progress/Lang/Error.cls
./skeleton/oo4gl/Progress/Lang/LockConflict.cls
./skeleton/oo4gl/Progress/Lang/Object.cls
./skeleton/oo4gl/Progress/Lang/OERequestInfo.cls
./skeleton/oo4gl/Progress/Lang/ParameterList.cls
./skeleton/oo4gl/Progress/Lang/ProError.cls
./skeleton/oo4gl/Progress/Lang/SysError.cls
./skeleton/oo4gl/Progress/Reflect/DataType.cls
./skeleton/oo4gl/Progress/Reflect/Property.cls
./skeleton/oo4gl/Progress/Reflect/Variable.cls
./skeleton/oo4gl/Progress/Util/EnumHelper.cls
./skeleton/oo4gl/Progress/Util/ResourceManager.cls
./skeleton/oo4gl/Progress/Util/TypeHelper.cls
  • these are .NET-related classes and no impl or Java stubs is required:
    ./skeleton/oo4gl/Progress/Windows/ComponentsCollectionType.cls
    ./skeleton/oo4gl/Progress/Windows/Form.cls
    ./skeleton/oo4gl/Progress/Windows/IForm.cls
    
  • the oo4gl/Ccs holder classes I think should be fully implemented, these should be pretty simple

The support for these classes is reported as:

There should be new testcases unit tests which cover progress.* classes. Please report what unit test support exists for these classes.

#8 Updated by Greg Shah over 1 year ago

in this task we can track the non-ADE .cls implementation (i.e. what is not covered by #9488)

Yes, that makes sense.

Make sure we take any pending work on these classes which exists in 6410b. We may be throwing away the other changes but I guess we have some improvements already.

#9 Updated by Ioana-Cristina Prioteasa over 1 year ago

Constantin Asofiei wrote:

For the first stage, we need to implement the missing progress or ccs classes - double-check the support for these:

  • ./skeleton/oo4gl/Ccs/Common/Support/IInt64Holder.cls
    - This is inside the ADE source at ADE/abl/src/corelib/Ccs/Common/Support/IInt64Holder.cls, so this will get covered by #9488.
Class Implemented in Conversion Support Level Runtime Support Level
./skeleton/oo4gl/Progress/Data/BindingSource.cls - - -
./skeleton/oo4gl/Progress/Util/EnumHelper.cls - - -
./skeleton/oo4gl/Progress/Util/ResourceManager.cls - - -
./skeleton/oo4gl/Progress/Util/TypeHelper.cls - - -
./skeleton/oo4gl/Progress/Lang/LockConflict.cls - - -
./skeleton/oo4gl/Progress/Lang/Class.cls com.goldencode.p2j.oo.lang.LegacyClass PARTIAL PARTIAL
./skeleton/oo4gl/Progress/Reflect/Property.cls com.goldencode.p2j.oo.reflect.Property FULL STUB
./skeleton/oo4gl/Progress/Reflect/Variable.cls com.goldencode.p2j.oo.reflect.Variable FULL STUB
./skeleton/oo4gl/Progress/Lang/OERequestInfo.cls com.goldencode.p2j.oo.lang.OerequestInfo FULL STUB
./skeleton/oo4gl/Progress/Json/ObjectModel/JsonArray.cls com.goldencode.p2j.oo.json.objectmodel.JsonArray FULL + RESTRICTED PARTIAL
./skeleton/oo4gl/Progress/Lang/ParameterList.cls com.goldencode.p2j.oo.lang.ParameterList FULL BASIC
./skeleton/oo4gl/Progress/Lang/ProError.cls com.goldencode.p2j.oo.lang.ProError FULL BASIC
./skeleton/oo4gl/Progress/Json/ObjectModel/JsonConstruct.cls com.goldencode.p2j.oo.json.objectmodel.JsonConstruct FULL FULL
./skeleton/oo4gl/Progress/Json/ObjectModel/JsonObject.cls com.goldencode.p2j.oo.json.objectmodel.JsonObject FULL FULL
./skeleton/oo4gl/Progress/Json/ObjectModel/ObjectModelParser.cls com.goldencode.p2j.oo.json.objectmodel.ObjectModelParser FULL FULL
./skeleton/oo4gl/Progress/Lang/AppError.cls - com.goldencode.p2j.oo.lang.AppError FULL FULL
./skeleton/oo4gl/Progress/Lang/Enum.cls com.goldencode.p2j.oo.lang.LegacyEnum FULL FULL
./skeleton/oo4gl/Progress/Lang/Error.cls com.goldencode.p2j.oo.lang.LegacyError FULL FULL
./skeleton/oo4gl/Progress/Lang/Object.cls com.goldencode.p2j.oo.lang.BaseObject FULL FULL
./skeleton/oo4gl/Progress/Lang/SysError.cls com.goldencode.p2j.oo.lang.SysError FULL FULL
./skeleton/oo4gl/Progress/Reflect/DataType.cls com.goldencode.p2j.oo.reflect.DataType FULL FULL

I will look into 6410b to see what changes are helpful.

#10 Updated by Marian Edu over 1 year ago

I've generated 'skeleton' OO classes for OE 12.8 - as it looks through OO reflection - you can find them in testcases/oo/skeleton/12.8 in revision #1705. Please not all classes/interfaces in OpenEdge.Core.Collections are generic types, this is only possible for Progress 'internal' code right now and not available for us mortals just yet :)

#11 Updated by Ioana-Cristina Prioteasa over 1 year ago

Unfortunately 6410b does not change the status of the support for the classes in #9436-9.

#12 Updated by Ioana-Cristina Prioteasa over 1 year ago

  • Status changed from New to WIP
  • reviewer Constantin Asofiei added

Created 9436a and committed to rev. 15728, the converted skeletons from the Progress package needed on #9488.
From #9436-9, I still need to convert Progress.Data.BindingSource, Progress.Util.EnumHelper, Progress.Util.ResourceManager and Progress.Util.TypeHelper.
Working on this as we speak, I will commit those also and then ask for a review.

#13 Updated by Ioana-Cristina Prioteasa over 1 year ago

To convert the above I needed these skeletons added:
  • Progress.Data.ChildrenAllowEdit
  • Progress.Data.ChildrenAllowNew
  • Progress.Data.ChildrenAllowRemove
  • Progress.Data.ChildrenInputValue
  • Progress.Data.InputValue
  • Progress.Data.CancelCreateRowEventArgs
  • Progress.Data.CreateRowEventArgs
  • Progress.Data.SortRequestEventArgs
  • System.ComponentModel.ComponentResourceManager

I found all of them, except the last System.ComponentModel.ComponentResourceManager, this is not in skeleton/dotnet/System/ComponentModel/ and in testcases/oo there is nothing regarding dotnet.
Marian, do you know if this skeleton exists of how can I generate it?

#14 Updated by Constantin Asofiei over 1 year ago

I think we need a 'hard stop' if you reach .NET classes/behavior. I assume BindingSource or ResourceManager is the 'source' of the problem?

#15 Updated by Ioana-Cristina Prioteasa over 1 year ago

  • Status changed from WIP to Review

There are dependencies on dotnet classes in all the classes left from the table in #9436-9: Progress.Data.BindingSource, Progress.Util.EnumHelper, Progress.Util.ResourceManager and Progress.Util.TypeHelper.

As these are not to be handled right now, we can move to review.
Constantin, please review 9436a rev. 15728.

#16 Updated by Constantin Asofiei over 1 year ago

Please rebase 9436a.

#17 Updated by Ioana-Cristina Prioteasa over 1 year ago

9436a is rebased.

#18 Updated by Constantin Asofiei over 1 year ago

skeleton/oo4gl/Ccs/Common/Support/IInt64Holder.cls and the other 'holders' in Ccs package need to be hand-written.

#19 Updated by Ioana-Cristina Prioteasa over 1 year ago

Committed on 9436a rev. 15752:
  • Added 2 new converted skeletons: Progress.IO.MemoryOutputStream, Progress.IO.ByteOrder, needed on #9488.

#20 Updated by Ioana-Cristina Prioteasa over 1 year ago

Committed on 9436a rev. 15753 - Added converted skeletons for multiple classes from Ccs.Common.Support, OpenEdge.Core, OpenEdge.Core.System, OpenEdge.Core.Util, OpenEdge.Logging, OpenEdge.Security:

  • p2j/oo/common/support/IdateTimeTzHolder.java
  • p2j/oo/common/support/IdecimalHolder.java
  • p2j/oo/common/support/Iint64Holder.java
  • p2j/oo/common/support/IlongcharArrayHolder.java
  • p2j/oo/common/support/IprimitiveArrayHolder.java
  • p2j/oo/core/DataTypeHelper.java
  • p2j/oo/core/EventArgs.java
  • p2j/oo/core/ImemoryPointer.java
  • p2j/oo/core/LegacyDecimal.java
  • p2j/oo/core/LegacyInteger.java
  • p2j/oo/core/LongcharArrayHolder.java
  • p2j/oo/core/StringConstant.java
  • p2j/oo/core/TimeStampConstants.java
  • p2j/oo/core/system/InvalidValueSpecifiedError.java
  • p2j/oo/core/system/NotFoundError.java
  • p2j/oo/core/util/Token.java
  • p2j/oo/core/util/TokenResolver.java
  • p2j/oo/core/util/TokenResolverEventArgs.java
  • p2j/oo/logging/LogEvent.java
  • p2j/oo/security/Principal.java

This completes the list from #9488-78, now all classes exist in p2j.
Note: I added some LegacyResourceSupport by hand. If the annotation is also needed at PROPERTY level, I will make the necessary changes to conversion.

#21 Updated by Constantin Asofiei over 1 year ago

  • Status changed from Review to Merge Pending

9436a/15754 adds OEUnit related skeletons/changes.

Ioana: please merge after 9768a.

#22 Updated by Ioana-Cristina Prioteasa over 1 year ago

9436a is merged to trunk as rev. 15782 and archived.

#23 Updated by Ioana-Cristina Prioteasa over 1 year ago

Below is an updated list of the current status, what tests exist and extra classes that need to be implemented from #9488 dependencies.

To implement

Class Tests Notes
Progress.Data.BindingSource - has .NET dependencies
Progress.Util.EnumHelper - has .NET dependencies
Progress.Util.ResourceManager - has .NET dependencies
Progress.Util.TypeHelper - has .NET dependencies
Progress.Reflect.Property testcases/tests/oo/progress/reflect/property was in trunk, but only stubs
Progress.Reflect.Variable testcases/tests/oo/progress/reflect/variable was in trunk, but only stubs
Progress.Lang.OERequestInfo used in :
testcases/tests/oo/openedge/core/collections/list/quirks/TestMethodGetIntQuirk.cls
testcases/appsrv/api/dataset/get_current_request_info.p
testcases/appsrv/api/dataset/get_current_response_info.p
but it does not seem to have dedicated ones
was in trunk, but only stubs
Progress.Collections.HashMap - Needed on 9488
Progress.Collections.KeyValuePair - Needed on 9488
Progress.Collections.List - Needed on 9488
Progress.Collections.SortedSet - Needed on 9488
Progress.IO.ByteOrder - Needed on 9488
Progress.IO.MemoryOutputStream - Needed on 9488
Progress.Lang.LockConflict - handled by Eduard AFAIK
Progress.Lang.Stop - handled by Eduard AFAIK
Progress.Lang.StopAfter - handled by Eduard AFAIK
Progress.Lang.StopError - handled by Eduard AFAIK
Progress.Lang.UserInterrupt - handled by Eduard AFAIK

To complete

Class Tests Notes
Progress.Lang.Class testcases/tests/oo/progress/lang/class/ partial support reported
Progress.Json.ObjectModel.JsonArray used in tests at testcases/tests/oo/json/ partial support reported
Progress.Lang.ParameterList testcases/tests/oo/progress/lang/parameter_list basic support reported
Progress.Lang.ProError testcases/tests/oo/progress/lang/proerror basic support reported

To test

Class Tests Notes
Progress.Json.ObjectModel.JsonConstruct used in tests at testcases/tests/oo/json/ -
Progress.Json.ObjectModel.JsonObject testcases/tests/oo/json/object -
Progress.Json.ObjectModel.ObjectModelParser used in tests at testcases/tests/oo/json/parser -
Progress.Lang.AppError used in tests at testcases/tests/error_handling/ -
Progress.Lang.Enum testcases/oo/enums/ -
Progress.Lang.Error used in tests at testcases/tests/error_handling/ -
Progress.Lang.Object used in tests at testcases/tests/oo/progress/lang/ -
Progress.Lang.SysError testcases/tests/oo/progress/lang/syserror -
Progress.Reflect.DataType used in tests at testcases/tests/oo/progress/reflect -

#24 Updated by Constantin Asofiei over 1 year ago

Just to be clear, classes with .NET dependencies will not be implemented.

#25 Updated by Ioana-Cristina Prioteasa over 1 year ago

  • Status changed from Merge Pending to Review

Committed in the testcases project rev. 1730:
- test for Progress.IO.MemoryOutputStream: at /testcases/tests/oo/progress/io/TestMemoryOutputStream.cls
- minimal test for Progress.IO.ByteOrder: at /testcases/tests/oo/progress/io/TestByteOrder.cls

Committed in 9436b rev.15825:
- Added implementations for builtin functions of Progress.IO.MemoryOutputStream
- Enhanced memptr:setLength() to support buffer resizing while preserving old data. Also exposed the methods I needed in MemoryOutputStream.

All 15 tests for MemoryOutputStream are passing now with latest 9436b.
Also the 2 tests for ByteOrder pass, even tho I made no changes to ByteOrder. This contains only 3 enums and has no other functions or usages.

Notes:
One noteworthy aspect was the difference in behavior between the two constructors of Progress.IO.MemoryOutputStream. As described in the official documentation(https://docs.progress.com/bundle/abl-reference/page/Progress.IO.MemoryOutputStream-class.html), when the object is created using the constructor without parameters, both Length and BytesWritten are initialized to 0, and subsequent Write() and Clear() calls can change the Length dynamically.

In contrast, when the object is initialized with the constructor that takes a size parameter, the Length is fixed to that value. In this case, calling Clear() will reset BytesWritten to 0 but will not modify the Length.

Constantin, please review 9436b rev.15825.
What should be the next steps? The rest of the classes that need implementations all contain generics. Should I move to what is already implemented? See what tests we have, enhance them and fix implementations?

#26 Updated by Ioana-Cristina Prioteasa over 1 year ago

This is the latest list of what is needed from the Progress package:

STUB

  • ./skeleton/oo4gl/Progress/Lang/LockConflict.cls - existent in p2j at com.goldencode.p2j.oo.lang.LockConflict
  • ./skeleton/oo4gl/Progress/Reflect/Constructor.cls - existent in p2j at com.goldencode.p2j.oo.reflect.LegacyConstructor
  • ./skeleton/oo4gl/Progress/Lang/OERequestInfo.cls - existent in p2j at com.goldencode.p2j.oo.lang.OerequestInfo
  • ./skeleton/oo4gl/Progress/Lang/Stop.cls - existent in p2j at com.goldencode.p2j.oo.lang.Stop
  • ./skeleton/oo4gl/Progress/Reflect/Property.cls - existent in p2j at com.goldencode.p2j.oo.reflect.Property
  • ./skeleton/oo4gl/Progress/Reflect/Variable.cls - existent in p2j at com.goldencode.p2j.oo.reflect.Variable

PARTIAL/BASIC

  • ./skeleton/oo4gl/Progress/Json/ObjectModel/JsonArray.cls - existent in p2j at com.goldencode.p2j.oo.json.objectmodel.JsonArray - rt PARTIAL.
  • ./skeleton/oo4gl/Progress/Lang/Class.cls - existent in p2j at com.goldencode.p2j.oo.lang.LegacyClass - rt PARTIAL.
  • ./skeleton/oo4gl/Progress/Lang/ParameterList.cls - existent in p2j at com.goldencode.p2j.oo.lang.ParameterList - rt BASIC.
  • ./skeleton/oo4gl/Progress/Lang/ProError.cls - existent in p2j at com.goldencode.p2j.oo.lang.ProError - rt BASIC.
  • ./skeleton/oo4gl/Progress/Reflect/Event.cls - existent in p2j at com.goldencode.p2j.oo.reflect.Event - rt PARTIAL.
  • ./skeleton/oo4gl/Progress/Reflect/Method.cls - existent in p2j at com.goldencode.p2j.oo.reflect.Legacy4GLMethod - reported STUB but seems implemented.

FULL

  • ./skeleton/oo4gl/Progress/ApplicationServer/AdapterTypes.cls - existent in p2j at com.goldencode.p2j.oo.applicationserver.AdapterTypes - reported STUB but it is enum
  • ./skeleton/oo4gl/Progress/Json/JsonParser.cls - existent in p2j at com.goldencode.p2j.oo.json.JsonParser
  • ./skeleton/oo4gl/Progress/Json/ObjectModel/JsonConstruct.cls - existent in p2j at com.goldencode.p2j.oo.json.objectmodel.JsonConstrunct
  • ./skeleton/oo4gl/Progress/Json/ObjectModel/JsonObject.cls - existent in p2j at com.goldencode.p2j.oo.json.objectmodel.JsonObject
  • ./skeleton/oo4gl/Progress/Json/ObjectModel/ObjectModelParser.cls - existent in p2j at com.goldencode.p2j.oo.json.objectmodel.ObjectModelParser
  • ./skeleton/oo4gl/Progress/Lang/AppError.cls - existent in p2j at com.goldencode.p2j.oo.lang.AppError
  • ./skeleton/oo4gl/Progress/Lang/Enum.cls - existent in p2j at com.goldencode.p2j.oo.lang.LegacyEnum
  • ./skeleton/oo4gl/Progress/Lang/Error.cls - existent in p2j at com.goldencode.p2j.oo.lang.LegacyError
  • ./skeleton/oo4gl/Progress/Lang/FlagsEnum.cls - existent in p2j at com.goldencode.p2j.oo.lang.FlagsEnum
  • ./skeleton/oo4gl/Progress/Lang/Object.cls - existent in p2j at com.goldencode.p2j.oo.lang.BaseObject
  • ./skeleton/oo4gl/Progress/Lang/OEVersionInfo.cls - existent in p2j at com.goldencode.p2j.oo.lang.OeversionInfo
  • ./skeleton/oo4gl/Progress/Lang/SysError.cls - existent in p2j at com.goldencode.p2j.oo.lang.ProError
  • ./skeleton/oo4gl/Progress/Reflect/AccessMode.cls - existent in p2j at com.goldencode.p2j.oo.reflect.AccessMode
  • ./skeleton/oo4gl/Progress/Reflect/Flags.cls - existent in p2j at com.goldencode.p2j.oo.reflect.Flags
  • ./skeleton/oo4gl/Progress/Reflect/Parameter.cls - existent in p2j at com.goldencode.p2j.oo.reflect.Parameter
  • ./skeleton/oo4gl/Progress/Reflect/ParameterMode.cls - existent in p2j at com.goldencode.p2j.oo.reflect.ParameterMode
  • ./skeleton/oo4gl/Progress/Reflect/DataType.cls - existent in p2j at com.goldencode.p2j.oo.reflect.DataType

#27 Updated by Constantin Asofiei over 1 year ago

Thanks, for now work on the ADE dependencies for Progress package.

#28 Updated by Ioana-Cristina Prioteasa over 1 year ago

Committed to 9436b:
  • rev. 15826: Corrected support level for IprimitiveArrayHolder, IlongcharArrayHolder, Iint64Holder, IdateTimeTzHolder, AdapterTypes.
  • rev. 15827: Included constructor with 2 parameters in ArrayIterator added in newer versions of Progress.

#29 Updated by Ioana-Cristina Prioteasa over 1 year ago

Besides the new constructor ArrayIterator is now implementing IListIterator. This is the diff of the skeletons:

=== modified file 'oo4gl/OpenEdge/Core/Collections/ArrayIterator.cls'
--- old/oo4gl/OpenEdge/Core/Collections/ArrayIterator.cls    2020-07-29 11:20:46 +0000
+++ new/oo4gl/OpenEdge/Core/Collections/ArrayIterator.cls    2025-02-17 08:43:14 +0000
@@ -1,9 +1,13 @@
 class OpenEdge.Core.Collections.ArrayIterator
-    implements OpenEdge.Core.Collections.IIterator:
+    implements OpenEdge.Core.Collections.IListIterator, 
+        OpenEdge.Core.Collections.IIterator:

     constructor public ArrayIterator ( poIteratedArray as OpenEdge.Core.Collections.Array):
     end.

+    constructor public ArrayIterator ( pIteratedArray as OpenEdge.Core.Collections.Array, pIndex as integer):
+    end.
+
     define protected property CurrentExtent as integer no-undo
         protected get.
         protected set.
@@ -15,9 +19,21 @@
     method public logical HasNext ():
     end.

+    method public logical HasPrevious ():
+    end.
+
     method public Progress.Lang.Object Next ():
     end.

+    method public integer NextIndex ():
+    end.
+
+    method public Progress.Lang.Object Previous ():
+    end.
+
+    method public integer PreviousIndex ():
+    end.
+
     method public logical Remove ():
     end.

We need to implement these as well.

#30 Updated by Ioana-Cristina Prioteasa over 1 year ago

Progress.Collections.List implements Progress.Collection.IIterable, with method getIterator(), in Progress the type of this iterator is Progress.Collections.ListIterator<Progress.Lang.Object>. We need to implement Progress.Collections.ListIterator as well. This is it's skeleton:

class Progress.Collections.ListIterator
        implements Progress.Collections.IIterator final:

        define public property Current as Progress.Lang.Object no-undo
                public get.

        method public logical MoveNext ():
        end.

        method public void Reset ():
        end.

end.

I am not sure how to implement moveNext, only having the current object, and no constructor with parameters..
I will convert this skeleton and add it in 9436b.

#31 Updated by Constantin Asofiei over 1 year ago

There must be some internal members which are not exposed. Otherwise, it may be that:
  • having list [a, b, c, d]
  • Current = b
  • MoveNext finds the location of Current in the list and gets the next value, so it will be c
  • but what happens with [a, b, c, b, d]? - please experiment.

Otherwise, we can save the collection instance ListIterator is walking, and just use a Java iterator over the collection.

#32 Updated by Ioana-Cristina Prioteasa over 1 year ago

But how do I get the list in the iterator? I'll write some unit-tests.

#34 Updated by Ioana-Cristina Prioteasa over 1 year ago

Committed to 9436b rev.15853:
  • Completed implementation for Progress.Collection.List.
  • Added Progress.Collection.ListIterator with completed implementation.
  • Modified Icomparable to use generics.
  • Added in BasaDataType the hashCode function, the implementation for the new hash-code() builtin function - now I use Objects.hashcode. I will test this more in Progress and fully implement it.

#35 Updated by Ioana-Cristina Prioteasa over 1 year ago

Committed to 9436b rev.15854: completed implementation of OpenEdge.Core.Collections.ArrayIterator. This is an example of class that is different between Progress versions. The diff of the stubs is posted in #9436-29.

For implementing, I first went and tested with Progress 12.8 the existent tests at /testcases/tests/oo/openedge/core/collections/array_iterator. These were failing(most of them). I adjusted them to pass and added tests for the new constructor and methods. Converted and worked on the implementation. These tests are dependent on OpenEdge.Core.Collections.Array that is only STUB in fwd. I used the converted class we got in #9488(had some issues here also but I will talk about them in a separate post on #9488).
I adjusted the existent implementation for the next() function, it has an extra Assert before the actual implementation: Assert.isTrue(ArrayIterator.this.hasNext());. and some logic. Besides that I just added the new function and the new constructor.

I tested now only the TestConstructor.TestConstructorArray, and in older version of progress it is correct like this:

oAI = new ArrayIteratorStub(oArray) no-error.
support.test.AssertExt:Error(0, 'Iterated Array cannot be null'). // Constructor with null param should throw error

while in 12.8 I had to change this line to:
oAI = new ArrayIteratorStub(oArray) no-error.
support.test.AssertExt:Error(0, 'Iterated Array cannot be unknown'). // Constructor with null param should throw error

This is just one example of the differences.
I am not sure how to handle these:
1. in testcases: Should I modify the existent tests? Not sure if that is ok, they seem to be correct for v11. I was thinking of creating /testcases/oo/openedve/v12/.. and commit my tests there instead of modifying the already existent tests.
2. In fwd I am not sure on how to tread this. I want to check all the tests(not only the TestConstructor) to see that they work in v 11, convert them and test in fwd also to see if my ArrayIterator implementation(that works for v12) is messing things up. I think it will, especially for the next method.

Greg/Constantin, please advice.

#36 Updated by Greg Shah over 1 year ago

I am not sure how to handle these:
1. in testcases: Should I modify the existent tests? Not sure if that is ok, they seem to be correct for v11. I was thinking of creating /testcases/oo/openedve/v12/.. and commit my tests there instead of modifying the already existent tests.
2. In fwd I am not sure on how to tread this. I want to check all the tests(not only the TestConstructor) to see that they work in v 11, convert them and test in fwd also to see if my ArrayIterator implementation(that works for v12) is messing things up. I think it will, especially for the next method.

The key question here: is the core test code the same between these versions? Can the differences between versions be handled by small amounts of conditional code?

If so, then our preferred approach is to implement some form of conditional processing based on the OE version. This might be at preprocessing time (if needed) but it would be better if this could be a runtime decision (using the version methods in EnvironmentOps).

The preprocessor solution should only be used for code that cannot compile (in OE) without such conditional code. Otherwise, if the code will compile in all versions of OE then add runtime code to check the version and drop through different logic as needed.

#37 Updated by Greg Shah over 1 year ago

I don't want to duplicate the test code by version unless the test code itself is drastically different.

#38 Updated by Marian Edu over 1 year ago

Ioana-Cristina Prioteasa wrote:

Committed to 9436b rev.15854: completed implementation of OpenEdge.Core.Collections.ArrayIterator. This is an example of class that is different between Progress versions. The diff of the stubs is posted in #9436-29.

For implementing, I first went and tested with Progress 12.8 the existent tests at /testcases/tests/oo/openedge/core/collections/array_iterator. These were failing(most of them).

Those were already fixed for OE12.8, most of the issues are coming from stupid changes on error messages (they seems to have a real problem of what word to use 'null' or 'unknown'). So far we've used different asserts based on the OE version (runtime check), for other more complex changes like methods that were removed/renamed where we had to use preprocessor to make the code compile on both versions.

As Greg said his preference is to not duplicate the tests for each OE version, this might lead to somehow more complicated tests down the path but till the number of differences isn't that high this will probably work.

Anyway, the changes were committed in testcases in rev #1734.

#39 Updated by Ioana-Cristina Prioteasa over 1 year ago

I might be doing something wrong, I am not not running the tests in the testcases project. I convert them separately and run them.
I see the changes in testcases-1734 mostly add files in tests/preproc, does not change the actual tests. For these changes to take effect I need to run them inside testscases project? Do I need to add some special configuration? I am also a bit unsure how to test in Progress. Do I need the whole project?

#40 Updated by Ioana-Cristina Prioteasa over 1 year ago

I investigated the new hash-code() function added in Progress 12.
A few points worth noting:
  • the formula used is:
    result = 1;
    for each argument arg:
       result = 31 * result + HASH-CODE(arg);
    

    But this is for when we have 2 or more arguments, for one argument we should return only the hash, not 31 + hash. I used a getIndividualHash(BaseDataType arg) helper method that uses arg.hashCode(), overridden function from BaseDataType to compute the individual hash.
  • for unknown types: HASH-CODE(?) = 0
  • A more interesting thing: HASH-CODE (5) = HASH-CODE (5.00), so if a decimal is equivalent to an integer, we need to use the integer hash.

For now my tests focus more on the properties of this and how it is calculated when we have multiple arguments, not exactly on how the individual HASH-CODE is computed.
I experimented briefly in this area and I found that HASH-CODE(1)=1, HASH-CODE(40)=40, and so on for integer types. Our implementation for integer.hashCode() does not follow these rules.
So if I were to check the exact value returned, tests would not pass.
I am not sure about modifying the already implemented BaseDataType.hashCode() for each type.
Any opinions on this? Should I start looking into how each data type's hash looks?

In the meantime, I committed my changes to 9436b, rev.15855, it contains conversion and runtime support for this, and with this revision my unit tests pass.
The conversion support is also in 9488a, rev. 15850, but I had a small conversion bug, when I would pass HASH-CODE (1), it was not wrapped in integer. I fixed that in 9436b.

#41 Updated by Ioana-Cristina Prioteasa about 1 year ago

Committed on testcases project rev. 1744: Added tests for Progress.Collections.List and built-in function HASH-CODE.

#42 Updated by Ioana-Cristina Prioteasa about 1 year ago

Marian, I am now looking at the tests for OpenEdge.Core.Collections.ArrayIterator at tests/oo/openedge/core/collections/array_iterator/:
  • Running in our VM with older progress version:
    • TestConstructor: passes
    • TestMethodHasNext: passes
    • TestMethodNext: fails
              // iterate array and check method ----------------------
              do while oAI:HasNext():
                  Assert:Equals(counter, oAI:GetCurrentExtent()). // CurrentExtent before Next should be as expected
      
                  oPLO = oAI:Next() no-error.
                  support.test.AssertExt:NotErrorNotWarning(). // method call inside array size limits should not throw error ------------------------------> it fails here
      
                  Assert:IsFalse(valid-object(oPLO)). // because array is empty response should be invalid object
                  Assert:Equals(counter + 1, oAI:GetCurrentExtent()). // Next should increase CurrentExtent property by 1
      
                  counter = counter + 1.
              end.
      

      I eliminated no error and the error I get is: Extent cannot be zero.. I fixed this part like this:
                  Assert:Equals(counter, oAI:GetCurrentExtent()). // CurrentExtent before Next should be as expected
      
                  if oAI:GetCurrentExtent() EQ 0 then do:
                     oPLO = oAI:Next() no-error.
                     support.test.AssertExt:Error(0, 'Extent cannot be zero'). 
                  end.
                  else do:
                     oPLO = oAI:Next() no-error.
                     support.test.AssertExt:NotErrorNotWarning().
                  end.
      

      This construct appears 2 times in the test. And both times it gives error on first call when extent is 0.
      Next issue, this confuses me a bit. After the hasNext while, calling next one more time does not give error:
              oPLO = oAI:Next() no-error.
              if decimal(proversion) >= 12.8 then
                  support.test.AssertExt:Error(0).
              else
                  //support.test.AssertExt:Error(11388, 'Array subscript 11 is out of range.  The indeterminate extent is fixed to a dimension of 10. (11388)'). // method call for outside of array size limit should throw error -------------------------> was failing here
                  support.test.AssertExt:NotErrorNotWarning(). ------------------------> Now passing
      
    • TestMethodRemove: this does not compile because of this(used 3 times) Assert:Equals(?, lRsp). Equals cannot have unknown parameter. This needs to be replaced with: Assert:IsUnknown(lRsp).
      After correcting this, it fails here:
              // check method ----------------------
              lRsp = oAI:Remove() no-error.
              //support.test.AssertExt:Error(0, 'Current iterator position cannot be zero'). ----------------> fail here
              support.test.AssertExt:Error(0, 'Extent cannot be zero'). -------------------------------------> corrected
              Assert:IsUnknown(lRsp). 
      

      Then here, when counter = oArray:Size error is thrown:
              do counter = 1 to oArray:Size:
                  oArray:SetValue(oStr, counter).
              end.
      

      To correct it we need: do counter = 1 to oArray:Size - 1:.
      Another fail here:
              oAI = new ArrayIteratorStub(oArray) no-error.
              counter = 1.
      
              do while oAI:HasNext():
                  oPLO = oAI:Next() no-error.
      
                  if valid-object(oPLO) then 
                  do:
                      lRsp = oAI:Remove() no-error.
      
                      if counter = 1 then 
                          support.test.AssertExt:NotErrorNotWarning(). // on first call method should not throw error
                      else 
                          if decimal(proversion) >= 12.8 then
                              support.test.AssertExt:NotErrorNotWarning().  
                          else
                              support.test.AssertExt:Error(10068, 'Lead attributes in a chained-attribute expression (a:b:c) must be type HANDLE or a user-defined type and valid (not UNKNOWN). (10068)'). //  method should throw error
                      Assert:IsTrue(lRsp). // if object was removed then response should be true
                  end.
                  counter = counter + 1.
              end.
      

      I fixed this like:
              oAI = new ArrayIteratorStub(oArray) no-error.
              counter = 1.
      
              do while oAI:HasNext():
                  oPLO = oAI:Next() no-error.
      
                  if valid-object(oPLO) then 
                  do:
                      lRsp = oAI:Remove() no-error.
      
                      if counter = 1 then 
                          support.test.AssertExt:NotErrorNotWarning(). // on first call method should not throw error
                      else 
                          if decimal(proversion) >= 12.8 then do:
                              support.test.AssertExt:NotErrorNotWarning(). 
                              Assert:IsTrue(lRsp). // if object was removed then response should be true 
                          end.
                          else do:
                              MESSAGE(counter).
                              if counter = 2 then do:
                                  support.test.AssertExt:NotErrorNotWarning().
                                  Assert:IsTrue(lRsp). // if object was removed then response should be true
                              end.
                              else do:
                                  support.test.AssertExt:Error(10068, 'Lead attributes in a chained-attribute expression (a:b:c) must be type HANDLE or a user-defined type and valid (not UNKNOWN). (10068)'). //  method should throw error
                                  if counter = oArray:Size + 1 then
                                  Assert:IsFalse(lRsp).
                                  else
                                  Assert:IsTrue(lRsp). // if object was removed then response should be true
                              end.
                          end.
      
                  end.
                  counter = counter + 1.
              end.
      

      The last issue here:
              oAI = new ArrayIteratorStub(oArray) no-error.
              counter = 1.
              do while oAI:HasNext():
                  oPLO = oAI:Next() no-error.
      
                  if counter = 1 then 
                      if decimal(proversion) >= 12.8 then
                           Assert:IsTrue(valid-object(oPLO)).
                      else
                          Assert:IsFalse(valid-object(oPLO)). // first object should be removed
                  else        
                      Assert:IsTrue(valid-object(oPLO)). // rest of the objects should not be removed
                  counter = counter + 1.
      

      Fixed:
              oAI = new ArrayIteratorStub(oArray) no-error.
              counter = 1.
              do while oAI:HasNext():
                  oPLO = oAI:Next() no-error.
      
                  if counter = 2 then 
                      if decimal(proversion) >= 12.8 then
                           Assert:IsTrue(valid-object(oPLO)).
                      else
                          Assert:IsFalse(valid-object(oPLO)). // first object should be removed
                  else        
                      Assert:IsTrue(valid-object(oPLO)). // rest of the objects should not be removed
                  counter = counter + 1.
              end.
      
    • TestPropertyCurrentExtent: passes
    • TestPropertyIteratedArray: passes

I am thinking of applying these correction and move to testing these in version 12 as well. If more mismatch found use the version check if decimal(proversion) >= 12.8 then do:. I will also retest the new tests for the new methods only in v12 in older version and just skip them if version is smaller.

#43 Updated by Ioana-Cristina Prioteasa about 1 year ago

For integrating the v12 tests I think I need to use the preprocessor. For example in ArrayIteratorStub I need to add this:

    constructor public ArrayIteratorStub ( input poIteratedArray as Array, input pIndex as integer):
        super (input poIteratedArray, input pIndex).
    end constructor.

This gives compilation error in v11, while in v12 works perfectly. Is there an example in testcases where something like this is done? I am not exactly sure how to go about it.

#44 Updated by Marian Edu about 1 year ago

Ioana-Cristina Prioteasa wrote:

Marian, I am now looking at the tests for OpenEdge.Core.Collections.ArrayIterator at tests/oo/openedge/core/collections/array_iterator/:
  • Running in our VM with older progress version:

How old? In any case the baseline used for writing tests (ABLUnit style) was OE12.2, ABLUnit code as well as any OO code provided by Progress has changes between versions and we did not test with all versions not wrote the tests such a way that it will pass in all versions. We had to upgrade to 12.8 our development environment and we've made those tests pass in 12.2 and 12.8 using preprocessor or simple runtime check on proversion. There is no guaranty the tests will pass in any of the versions between 12.2 and 12.8 nor future versions, in fact those should only pass in 12.2 and 12.8. Using the same technique to use the same tests for all (maybe just supported) versions is going to be messy on the long run for sure.

I am thinking of applying these correction and move to testing these in version 12 as well. If more mismatch found use the version check if decimal(proversion) >= 12.8 then do:. I will also retest the new tests for the new methods only in v12 in older version and just skip them if version is smaller.

You can definitively try to update the tests to make it pass in older versions, or any other version needed apart from 12.2 and 12.8. I don't particularly like this approach but it's not my call here, it just makes those tests unnecessary complex and hard to understand.

One thing about using assertions is we already have one AssertExt support class that we use for error checking, if the tests must be able to run in all (supported) OE versions then it should be easier to move all assertion methods in that class and call the appropriate Assert method based on the OE version from there - like an abstraction layer to avoid doing that in the tests (like Equals with unknown, IsUnknown, IsNull, whatever PSC chooses to name those assert methods over time).

#45 Updated by Marian Edu about 1 year ago

Ioana-Cristina Prioteasa wrote:

For integrating the v12 tests I think I need to use the preprocessor. For example in ArrayIteratorStub I need to add this:

This gives compilation error in v11, while in v12 works perfectly. Is there an example in testcases where something like this is done? I am not exactly sure how to go about it.

Yes, please see tests.oo.openedge.core.collections.list.ListStub - the only way to go here is to use preprocessor :(

#46 Updated by Ioana-Cristina Prioteasa about 1 year ago

Marian Edu wrote:

How old? In any case the baseline used for writing tests (ABLUnit style) was OE12.2, ABLUnit code as well as any OO code provided by Progress has changes between versions and we did not test with all versions not wrote the tests such a way that it will pass in all versions. We had to upgrade to 12.8 our development environment and we've made those tests pass in 12.2 and 12.8 using preprocessor or simple runtime check on proversion. There is no guaranty the tests will pass in any of the versions between 12.2 and 12.8 nor future versions, in fact those should only pass in 12.2 and 12.8. Using the same technique to use the same tests for all (maybe just supported) versions is going to be messy on the long run for sure.

I tested with 11.6..
Seems like if we want these tests to work on all supported versions they will get endlessly more complicated. I am not sure how to go about this. If what is on xfer works on 12.2(i am not sure how I can access that version to test), but don't work in v11.6 nor on v 12.8, this complicates things a lot.

#47 Updated by Marian Edu about 1 year ago

Ioana-Cristina Prioteasa wrote:

If what is on xfer works on 12.2(i am not sure how I can access that version to test), but don't work in v11.6 nor on v 12.8, this complicates things a lot.

The tests should pass in 12.8, well we do use 12.8.6 to be precise. If you have a different 12.8 version and find tests that don't pass please let us know.

#48 Updated by Greg Shah about 1 year ago

We have customers that are on 11.x and will never go to 12.x. It is critical that the tests can work across multiple versions. We will NOT worry about anything other than an LTS release on 12.x (so 12.2 and 12.8). Yes, 11.x must be supported.

#49 Updated by Marian Edu about 1 year ago

Greg Shah wrote:

Yes, 11.x must be supported.

I don't really see the benefits, other than testing PSC code on OE, since the implementation in FWD is based on converting version 12.8 but I'm sure I'm missing the bigger picture :)

#50 Updated by Greg Shah about 1 year ago

We have customer applications that can only run in 11.x. Those applications will be compared with FWD using the OE 11.x environments.

#51 Updated by Ioana-Cristina Prioteasa about 1 year ago

I have a version of these tests that compile and pass both on 12.8 and 11.6.
I attached the zip.
Marian, would you be able to test these on the 12.2 environment?

I will continue with converting these and use EnvironmentOps.getVersion() to make the FWD implementation match the 4gl behavior.

#52 Updated by Constantin Asofiei about 1 year ago

9436b was rebased from trunk rev 15875 - new rev 15881.

#53 Updated by Constantin Asofiei about 1 year ago

Review for 9436b rev 15881:
  • MemoryOutputStream
    • please update the support annotations for MemoryOutputStream
    • is there a destructor in MemoryOutputStream, which automatically de-allocates the data memptr? Try a test like this: create an instance, allocate data and write something, get the data/memptr, delete the instance - is the data still in memory?
    • do not use bytesWritten = new int64(0); or such, use .assign methods; the point is: the instances are mutable and the actual (field/var) Java reference is immutable. For example, please fix clear_
    • setByteOrder_1 - the setByteOrder(_value); call is called outside of the internalProcedure code
    • instead of new logical(false) use logical.FALSE
    • public int64 write(final longchar _value, final logical _includeNull), and all others - the code needs to be inside an internalFunction or internalProcedure (if returns void) declaration - this is missing.
  • memptr.setLength - are the changes only for the MemoryOutputStream, or is this actually for the set-size(memptr) statement, too? This is for the resizing the memptr.
  • should Icomparable<T> be Icomparable<T extends _BaseObject_>? I assume you can't use 4GL native types like character.
  • oo.collections.List
    • use logical.TRUE and such, instead of i.e. new logical(true
    • addAll and others - use internalFunction or internalProcedure (if returns void)
  • oo.collections.ListIterator
    • moveNext and others - use internalFunction or internalProcedure (if returns void)
  • core.collections.ArrayIterator
    • why use Assert functions? Are these actual exceptions thrown by the runtime?
  • the i.e. __collections_listIterator_constructor__ also need to use internalProcedure and also need to call explicitly __lang_BaseObject_constructor__ - check all changed files in this task!
  • all methods which are from 4GL need to have internalFunction or internalProcedure - please double-check the files changed in this task.

#54 Updated by Ioana-Cristina Prioteasa about 1 year ago

In List.addAll I had:

public logical addAll(final object<? extends Icollection> otherCollections)
{
   boolean addedAny = false;

   if (otherCollections.isUnknown())
   {
      ErrorManager.recordOrThrowError(18193,
                                      "Invalid value specified for parameter 'otherCollections' of method or constructor 'addAll'",
                                      false);
      return new logical(false);
   }

I changed this to:
public logical addAll(final object<? extends Icollection> otherCollections)
{
   return function(List.class, this, "AddAll", logical.class, new Block((Body) () ->
   {
      boolean addedAny = false;

      if (otherCollections.isUnknown())
      {
         ErrorManager.recordOrThrowError(18193,
                                         "Invalid value specified for parameter 'otherCollections' of method or constructor 'addAll'",
                                         false);
         returnNormal(logical.FALSE);
      }

The error now pops up on screen and this fails, but the error is thrown..
silent(() -> result.assign(targetList.ref().addAll(new object())));
         com.goldencode.dataset.support.test.AssertExt.error(new integer(18193), new character("Invalid value specified for parameter 'otherCollections' of method or constructor 'AddAll'. (18193)"));

#55 Updated by Constantin Asofiei about 1 year ago

How is the test executed? With NO-ERRO?

#56 Updated by Ioana-Cristina Prioteasa about 1 year ago

Yes, and it gets converted as:

silent(() -> result.assign(targetList.ref().addAll(new object())));

When this gets executed I get the error pop up on screen and then:
com.goldencode.dataset.support.test.AssertExt.error(new integer(18193), new character("Invalid value specified for parameter 'otherCollections' of method or constructor 'AddAll'. (18193)"));

The above fails.
Removing the function wrap solves this, the error is not a pop up and the test passes.

#57 Updated by Ioana-Cristina Prioteasa about 1 year ago

Had a meeting with Constantin about this and it seems that the methods in the Progress package are not wrapped in a body. I removed all the internalProcedure and internalFunction from the classes I modified. I retested the tests I had and everything works as expected.

I still need to look at:
  • is there a destructor in MemoryOutputStream, which automatically de-allocates the data memptr?
  • memptr.setLength - are the changes only for the MemoryOutputStream, or is this actually for the set-size(memptr) statement, too? This is for the resizing the memptr. -- I need to test this properly for memptr as well. I used it directly in MemoryOutputStream like data.setLength(required); ant it did not behave well in my case. I will check set-size.

But I committed the partially addressed review in 9436b rev. 15882. I will move to commit to 9436b what in needed from 9488. I will revisit then the above points.

#58 Updated by Ioana-Cristina Prioteasa about 1 year ago

Committed on 9436b what is needed from 9488a:
  • rev. 15883: Support *=, -=, +=, /= operator syntax.
  • rev. 15884: Support for final modifier for class property.
  • rev. 15885: Conversion support and STUB runtime support for ClientPricipal:TENANT-ID and ClientPricipal:TENANT-NAME.
  • rev. 15886: Support for package-private access modifier.
  • rev. 15884: Bug fixes: resize needs an integer argument for the index, read extent from an EXPRESSION node, fixed the names for the extent property Java methods when loading a builtin .cls from FWD p2j.oo.

Hopefully I understood correctly and you wanted the last 3 in the same commit.. but now that I think about it.. Should I uncommit the last one or revert it and do 3 different commits?

#59 Updated by Ioana-Cristina Prioteasa about 1 year ago

I twitched the Array Iterator 4GL Unit test. It has a lot of differences between the versions.
The ArrayIterator uses OpenEge.Core.Collections.Array in the implementation and there in the original code:
&if integer(entry(1, proversion, '.')) ge 12 &then
        assign extent(this-object:Value) = pNewLength.
&else
        assign extent(oTempObject)       = this-object:Length
               oTempObject               = this-object:Value
               iMax                      = min(this-object:Size, pNewLength)
               extent(this-object:Value) = ?
               extent(this-object:Value) = pNewLength
               .
        /* On init this loop won't execute */
        do iLoop = 1 to iMax:
            assign this-object:Value[iLoop] = oTempObject[iLoop].
        end.
&endif

At the moment resolving the proversion at conversion time is broken as it tries to use EnviromentOps.getVersion that reads from directory. Constantin is aware of this. I did not go into that, but I modified the Array.cls to separate the 2 implementations, converted them and then reunited them with checks like:
if (_isGreaterThanOrEqual(new decimal(EnvironmentOps.getVersion()), decimal.fromLiteral("12.0")))

So in theory now the Array class should be ok on both versions. From my tests this is not the case.
There is some weird behavior that I could only solve by checking in some other places the version. Example:
oArray = new Array() no-error.

if decimal(proversion) >= 12.8 then
   Assert:Equals(0, oArray:Size).
else
   Assert:Equals(10, oArray:Size).

So I modified the converted Array:
   public void __core_collections___core_collections_Array_constructor__static___constructor__()
   {
      //  we don't have any elements yet
      internalProcedure(Array.class, this, "Array", new Block((Body) () ->
      {
         __core_collections_Array_constructor__(Array.getDefautArraySize());
         if (_isGreaterThanOrEqual(new decimal(EnvironmentOps.getVersion()), decimal.fromLiteral("12.0")))
         {
            mSize.assign(0);
         }
      }));
   }

I still have 2 tests that I can't get passing in version 11.6. In version 12 the tests all pass with fwd.
Some errors should e thrown but I can't really understand where they are coming from.
  • Extent cannot be zero.
    Progress test:
    // add objects in array ---------------------------------
            oStr = new String('string').
    
            oArray:SetValue(oStr, 3).
            oArray:SetValue(oStr, 5).
            oArray:SetValue(oStr, 8).
    
            oAI = new ArrayIteratorStub(oArray) .
            counter = 0.
    
            do while oAI:HasNext():
                Assert:Equals(counter, oAI:GetCurrentExtent()). // CurrentExtent before Next should as expected
    
               if oAI:GetCurrentExtent() EQ 0 AND decimal(proversion) < 12.8 then do:
                   oPLO = oAI:Next() .
                   support.test.AssertExt:Error(0, 'Extent cannot be zero'). 
                end.
                else do:
                   oPLO = oAI:Next() no-error.
                   support.test.AssertExt:NotErrorNotWarning().
                end.
    

    In Progress the Stack trace shows:
    - ArrayIterator.next
    - Array.getValue
    - Assert.NotNullorZero
    - Assert.NotZero.
    But it makes no sense, this is ArrayIterator.next
       @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Next", qualified = "progress.lang.object")
       @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
       public object<? extends com.goldencode.p2j.oo.lang._BaseObject_> next_()
       {
          return function(ArrayIterator.class, this, "Next", object.class, new Block((Body) () ->
          {
             Assert.isTrue(ArrayIterator.this.hasNext());
             setCurrentExtent(InputParameter.property(integer.class, plus(getCurrentExtent(), 1)));
             storeReturnValue(((Array) getIteratedArray().ref()).getValue(getCurrentExtent()));
          }));
       }
    

    So I have the extent 0 but it sets it to 1 before calling the getValue..
  • In the remove method I should get a Lead attributes in a chained-attribute expression (a:b:c) must be type HANDLE or a user-defined type and valid. I am not exactly sure how.. In the Progress stackTrace I see it's coming from Array.Remove.
    This is the method now:
       @LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Remove")
       @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
       public logical remove()
       {
          return function(ArrayIterator.class, this, "Remove", logical.class, new Block((Body) () ->
          {
             if (_isGreaterThanOrEqual(new decimal(EnvironmentOps.getVersion()), decimal.fromLiteral("12.0")))
             {
                Assert.notZero(currentExtent, new character("Current iterator position"));
             }
             else
             {
                Assert.notZero(currentExtent, new character("Extent"));
             }
             returnNormal(iteratedArray.ref().remove(iteratedArray.ref().getValue(currentExtent)));
          }));
       }
    

    The above was necessary for other tests to pass so not sure where to add the lead attributes error..

#60 Updated by Greg Shah about 1 year ago

At the moment resolving the proversion at conversion time is broken as it tries to use EnviromentOps.getVersion that reads from directory. Constantin is aware of this.

We should not use EnviromentOps.getVersion() at conversion time. I think we need an alterate approach there which reads from the p2j.cfg.xml.

#61 Updated by Ioana-Cristina Prioteasa about 1 year ago

I added the Array.cls and ArrayIterator.cls from github ADE, where they are the same for 12.8 and 11.7 release.
My unit tests with v12 are passing but with v11 they are not. This means that the implementation of these classes is different in 11.7 even if on github they have no differences.

#62 Updated by Constantin Asofiei about 1 year ago

Ioana-Cristina Prioteasa wrote:

I added the Array.cls and ArrayIterator.cls from github ADE, where they are the same for 12.8 and 11.7 release.
My unit tests with v12 are passing but with v11 they are not. This means that the implementation of these classes is different in 11.7 even if on github they have no differences.

For now, please document at the FWD implementation of these classes that the 11.7 support is based on the OpenEdge 11.7 release and not ADE, and fix the tests to pass using the OpenEdge default install for these.

#63 Updated by Ioana-Cristina Prioteasa about 1 year ago

  • File ArrayError.png added
  • reviewer Artur Școlnic added
  • reviewer deleted (Constantin Asofiei)

Ioana-Cristina Prioteasa wrote:

I still need to look at:
  • is there a destructor in MemoryOutputStream, which automatically de-allocates the data memptr?

No, the memptr is still allocated. I added a test in the MemoryOutputStreamTest for this.

  • memptr.setLength - are the changes only for the MemoryOutputStream, or is this actually for the set-size(memptr) statement, too?

I was wrong here. memptr.setLength was correct for memptr, I discovered that actually the memptr is reinitialized if it needs a bigger size. The pointer value differs. I also enhanced the tests here.

For ArrayIterator and Array I tried to make the tests pass but no matter how I tried adding the errors it would ruin other tests. There is some very weird for Array.next behavior with v11.

        oArray = new Array() no-error.
        oAI = new ArrayIteratorStub(oArray) no-error.
        MESSAGE oAI:GetCurrentExtent(). ----------0
        oAI:Next() no-error.
        MESSAGE oAI:GetCurrentExtent(). ----------1

Removing no-error this is the stacktrace:

So it calls Array.GetValue(0), but it still increments the extent? Makes no sense.

I committed my last changes in 9436b rev.15888: Reverted memptr.setLength incorrect changes, corrected MemoryOutputStream implementation, enhanced ArayIterator support.

I also added on devsrv01:/home/icp/Array.java - for the implementation of OpenEdge.Core.Collections.Array. This is converted but manually modified afterwards to be close to a full support for both versions. It's not complete as I explained previously. From the 6 tests for version 11, 2 fail:TestMethodNext, TestMethodRemove
I will write a separate post for the tests that I added in the testcases project.

#64 Updated by Ioana-Cristina Prioteasa about 1 year ago

Testcases tests added from #9436 and #9488:
  • Progress.IO.ByteOrder at tests/oo/progress/io/TestByteOrder.cls : testcases rev. 1730
  • Progress.IO.MemoryOutputStream at tests/oo/progress/io/TestMemoryOutputStream.cls: testcases rev. 1730
  • Progress.Collections.List at tests/oo/progress/collections/TestList.cls: testcases rev. 1744
  • HASH-CODE built in function at tests/base_language/builtin_functions/functionality/TestHash-Code.cls: testcases rev. 1744
  • OpenEdge.Core.Collections.ArrayIterator at tests/oo/openedge/core/collections/array_iterator/: testcases rev. 1748

#65 Updated by Ioana-Cristina Prioteasa about 1 year ago

  • Related to Feature #9955: Implement ClientPrincipal:TENANT-ID and ClientPrincipal:TENANT-NAME added

#66 Updated by Paul Bodale about 1 year ago

Rebase notification

Task branch 9436b was rebased with trunk rev. 15941. Did not encountered conflicts related to functionality.

#67 Updated by Constantin Asofiei about 1 year ago

Thanks, Paul. Some history entries were 'mixed up' during rebase - please do a bzr diff -r 15941 --using meld and fix them. Also some files have the history number twice.

I'll put this into conversion testing.

#68 Updated by Paul Bodale about 1 year ago

I've ordered the history entries based on the date is this what are you referring to?

#69 Updated by Constantin Asofiei about 1 year ago

Paul Bodale wrote:

I've ordered the history entries based on the date is this what are you referring to?

Yes, the order is not 'by date', is by 'when the change was made merged'. So ICP's change is made in this branch, and PBB's is in trunk - then PBB's history entry must be before ICP's change.

#70 Updated by Paul Bodale about 1 year ago

Constantin Asofiei wrote:

Yes, the order is not 'by date', is by 'when the change was made merged'. So ICP's change is made in this branch, and PBB's is in trunk - then PBB's history entry must be before ICP's change.

Thanks for pointing that out! Committed rev. 15955 that addresses this issue.

#71 Updated by Lorian Sandu about 1 year ago

Harness passed with 9436b

#72 Updated by Delia Mitric about 1 year ago

Smoke testing of another GUI customer app passed with 9436b. ✅

#73 Updated by Constantin Asofiei about 1 year ago

  • Assignee changed from Ioana-Cristina Prioteasa to Paul Bodale
  • Status changed from Review to Merge Pending

I'll merge 9436b after 10007a .

#74 Updated by Constantin Asofiei about 1 year ago

  • Status changed from Merge Pending to WIP

Branch 9436b was merged to trunk rev 15955 and archived.

Also available in: Atom PDF