Project

General

Profile

Support #4951

Longchar input parameter

Added by Marian Edu over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:

History

#1 Updated by Greg Shah over 3 years ago

  • Start date deleted (10/09/2020)
  • Description updated (diff)
  • Assignee set to Constantin Asofiei

From Marian:

Since 4GL allows passing a character (variable or string) for a longchar input parameter I thought we need to replace longchar with Text for all input parameters on OO methods. Although this could be handy if we want to call those methods from Java for converted 4GL code this seems not to be needed because the conversion make sure the parameter passed is a longchar:

oMap.ref().put(pcKey, new longchar(pcKey))). // pcKey is character
oMap.ref().put(pcKey, new longchar(new longchar("value")))). // string value used in code, seems a bit overdone :)

Question, is there a 'rule' for this as in do we must leave it longchar, can we use Text instead or this is actually a requirement (use Text instead of longchar)?

Thanks

#2 Updated by Constantin Asofiei over 3 years ago

Question, is there a 'rule' for this as in do we must leave it longchar, can we use Text instead or this is actually a requirement (use Text instead of longchar)?

The Java method definition at the legacy OO class which you are implementing must match exactly the signature for the 4GL definition. IIRC, there are checks where we infer even from the Java parameter's type if the arguments are compatible, during conversion or dynamic runtime calls for a method.

Is there something else with this task?

#3 Updated by Marian Edu over 3 years ago

Constantin Asofiei wrote:

Question, is there a 'rule' for this as in do we must leave it longchar, can we use Text instead or this is actually a requirement (use Text instead of longchar)?

The Java method definition at the legacy OO class which you are implementing must match exactly the signature for the 4GL definition. IIRC, there are checks where we infer even from the Java parameter's type if the arguments are compatible, during conversion or dynamic runtime calls for a method.

Understood, the only thing that bothered me there was the boxing to longchar when we had to call a method with a character value :(

Is there something else with this task?

Not really, all good thanks.

#4 Updated by Greg Shah over 3 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

Understood, the only thing that bothered me there was the boxing to longchar when we had to call a method with a character value :(

We agree, this is not preferred. In the long term we could consider something like using Scala which has very nice support for implicit type conversion, but we have no solution in the short term.

Also available in: Atom PDF