Consultor Eletrônico



Kbase P119604: Can't use protected variable in incrementing DO in subclass
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/25/2007
Status: Unverified

FACT(s) (Environment):

OpenEdge 10.1A

SYMPTOM(s):

Using OO4GL

Defining protected integer variable in class

Using protected variable in subclass

Subclass contains incrementing DO loop ("DO <integer> = <expression1> TO <expression2>")

Error occurs when loop is executed

SYSTEM ERROR: Invalid operation 86 passed to recursive runtime engine. (4382)

SYSTEM ERROR: Invalid operation <number> passed to recursive runtime engine. (4382)

CAUSE:

Bug# 20061018-014

FIX:

Upgrade to OpenEdge 10.1B or later

Workaround:
1. Use a variable local to the method to keep track of the counter.
This is typically the preferred approach as it does not affect the state of the entire object in the same way as using a protected data member does, and thus reduces the need for additional context management.


2. Rewrite the DO <integer> = <expression1> TO <expression2> loop into a DO WHILE construct.

For example:

DO iCount = 1 to 3:
/* insert code here */
END.

Becomes:
iCount = 1.
DO WHILE iCount <= 3:
/* insert code here */
iCount = iCount + 1.
END.

Other possible workarounds could be:
- Moving the variable definition to the subclass
- Changing it's access level to PUBLIC.
Both of these result in a functional change in the class however, and are therefore typically undesirable.