Project

General

Profile

Bug #4123

conversion generates incorrect java code for Extent statement

Added by Alexei Kaigorodov about 5 years ago. Updated over 4 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:

Related issues

Related to User Interface - Bug #3691: literal $ character in format appears on the right side of the fill-in New
Related to Base Language - Bug #4160: Arrays assigment issue WIP

History

#1 Updated by Alexei Kaigorodov about 5 years ago

  • Description updated (diff)

following 4GL code:

define variable valstrs as character extent no-undo.
EXTENT(valstrs) = 5.

converts to Java code:
public class DynExtTest
{
   public void execute()
   {
      character[] valstrs = TypeFactory.characterExtent();     
      externalProcedure(DynExtTest.this, new Block((Body) () -> 
      {
         valstrs = ArrayAssigner.resize(valstrs, 5);
      }));
   }
}

which causes syntax errors:
    [javac] /home/avk/Bugfix/3691/testcases/uast/src/com/goldencode/testcases/format_string/driver/DynExtTest.java:23: error: local variables referenced from a lambda expression must be final or effectively final
    [javac]          valstrs = ArrayAssigner.resize(valstrs, 5);
    [javac]                                         ^
    [javac] /home/avk/Bugfix/3691/testcases/uast/src/com/goldencode/testcases/format_string/driver/DynExtTest.java:23: error: local variables referenced from a lambda expression must be final or effectively final
    [javac]          valstrs = ArrayAssigner.resize(valstrs, 5);
    [javac]          ^
    [javac] 2 errors

#2 Updated by Alexei Kaigorodov about 5 years ago

  • Subject changed from ABL-to-Java converter generates uncorrect java code for Extent statement to Сonversion generates incorrect java code for Extent statement

#3 Updated by Greg Shah about 5 years ago

In what branch and revision can you recreate this problem (i.e. is this in trunk 11319)?

#4 Updated by Greg Shah about 5 years ago

  • Related to Bug #3691: literal $ character in format appears on the right side of the fill-in added

#5 Updated by Greg Shah over 4 years ago

  • Related to Bug #4160: Arrays assigment issue added

#6 Updated by Greg Shah over 4 years ago

  • Subject changed from Сonversion generates incorrect java code for Extent statement to conversion generates incorrect java code for Extent statement
  • Project changed from User Interface to Base Language

#7 Updated by Roger Borrello over 4 years ago

Greg Shah wrote:

In what branch and revision can you recreate this problem (i.e. is this in trunk 11319)?

I just recreated this in trunk-11339, but I cannot recreate in 4207a-11379

package com.goldencode.testcases.extent_parsing_problems;

import com.goldencode.p2j.util.*;

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

/**
 * Business logic (converted to Java from the 4GL source code
 * in extent_parsing_problems/unbount_extent.p).
 */
public class UnbountExtent
{
   /**
    * External procedure (converted to Java from the 4GL source code
    * in extent_parsing_problems/unbount_extent.p).
    */
   public void execute()
   {
      character[] valstrs = TypeFactory.characterExtent();

      externalProcedure(UnbountExtent.this, new Block((Body) () -> 
      {
         valstrs = ArrayAssigner.resize(valstrs, 5);
      }));
   }
}

#8 Updated by Greg Shah over 4 years ago

  • Status changed from New to Test
  • Start date deleted (06/26/2019)
  • % Done changed from 0 to 100

This is basically a duplicate of the issue #4160 and the fix is the same.

#9 Updated by Roger Borrello over 4 years ago

I was building hotel_chui (rev 210) using 4207a-11399, and I received this failure:

    [javac] Compiling 49 source files to /home/rfb/projects/hotel_gui/build/classes
    [javac] /home/rfb/projects/hotel_gui/src/com/goldencode/hotel/FwdEmbeddedDriver.java:1899: error: local variables referenced from an inner class must be final or effectively final
    [javac]                   btns = newRef;
    [javac]                   ^
    [javac] 1 error

BUILD FAILED

It does build with trunk.

#10 Updated by Greg Shah over 4 years ago

  • Status changed from Test to Closed
  • Assignee set to Constantin Asofiei

Branch 4207a was merged to trunk as revision 11344.

Also available in: Atom PDF