Project

General

Profile

Bug #3327

Oracle javac has problems to compile specific usages of some FWD API

Added by Jaroslaw Haziak over 6 years ago. Updated over 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
08/15/2017
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version:

History

#1 Updated by Jaroslaw Haziak over 6 years ago

Example of ABL:

DEF INPUT PARAM inChar AS CHAR NO-UNDO.
DEF OUTPUT PARAM ouChar AS CHAR NO-UNDO.

ouChar = REPLACE(
           REPLACE(
             REPLACE(
               REPLACE(
                 REPLACE(
                   REPLACE(inChar, 
                           'A', '1'),
                   'B', '2'),
                 'C', '3'),
               'D', '4'),
             'E', '5'),
           'F', '6').

is translated to the following code:

import com.goldencode.p2j.util.*;

import static com.goldencode.p2j.util.BlockManager.*;
import static com.goldencode.p2j.util.TextOps.*;

public class TestProc4
{
   public void execute(final character _inChar, final character ouChar)
   {
      character inChar = TypeFactory.initInput(_inChar);

      externalProcedure(TestProc4.this, new Block((Init) () -> 
      {
         TypeFactory.initOutput(ouChar);
      }, 
      (Body) () -> 
      {
         ouChar.assign(replaceAll(replaceAll(replaceAll(replaceAll(replaceAll(replaceAll(inChar, "A", "1"), "B", "2"), "C", "3"), "D", "4"), "E", "5"), "F", "6"));
      }));
   }
}

This short Java code is compiled by javac (1.8.0_144) in 50 seconds! (on my machine). When I add further nested REPLACE, the Java code is practically non-compilable by javac (it takes too much time to wait for result). But for Java compiler from Eclipse (using ecj-4.6.3.jar) this code is not a problem.

I know that this is rather the bug of javac and not FWD API, but I guess you should be aware of it.

My guess is that the problem for javac in this case is that TextOps.replaceAll has many overloaded versions and uses generics. And nesting calling of it, makes difficult to choose specific version of this method.

Also available in: Atom PDF