Kbase P146047: Calling PRIVATE method that queries the database fails to return results when called from a STATIC m
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  7/30/2009 |
|
Status: Unverified
SYMPTOM(s):
Calling PRIVATE method that queries the database fails to return results when called from a STATIC method
Setting PRIVATE method to PROTECTED causes error 12926
Protected element '' may only be accessed from within its class hierarchy. (12926)
OpenEdge 10.1C raises an error when attempting to run same code with method defined as PRIVATE
Cannot reference private member "<method>" off of an object reference.
FACT(s) (Environment):
Attempting to implement a singleton class
Flow of code:
Static method "DoSomethingStatic" is called.
This invokes the Static Constructor.
Static Constructor creates a new instance of "Test" class.
This invokes the Protected Constructor.
Static method "DoSomethingStatic" continues and invokes method "DoSomething" on the instance.
Changing the PRIVATE setting to PUBLIC causes the database query to return results as expected
All Supported Operating Systems
OpenEdge 10.1C
CHANGE:
Upgraded to OpenEdge 10.1C
CAUSE:
Bug# OE00183879
CAUSE:
It is never valid to access a PRIVATE or PROTECTED data member through an object reference. This is an attempt to access a data member in a separate instance of the class and PRIVATE /PROTECTED members can only be accessed from within the instance of the class/hierarchy where they are defined. The only way to access a PRIVATE or PROTECTED data members from within their class is to use either THIS-OBJECT or an unqualified reference, such as DoSomething(). However, both of those access methods are illegal inside a static method.
The code should not compile and execute when the method is defined as PRIVATE. OpenEdge 10.2A should raise an error message.
FIX:
Make the PRIVATE method that queries the database PUBLIC