Project

General

Profile

Bug #4589

menu case sensitivity and conversion

Added by Sergey Ivanovskiy about 4 years ago. Updated almost 4 years ago.

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

100%

billable:
No
vendor_id:
GCD
case_num:

4589_1.patch Magnifier (5.72 KB) Sergey Ivanovskiy, 03/18/2020 03:21 PM

4589_2.patch Magnifier (6.88 KB) Sergey Ivanovskiy, 03/18/2020 03:41 PM

4589_4.patch Magnifier (9.63 KB) Sergey Ivanovskiy, 03/19/2020 04:03 PM

4589_5.patch Magnifier (10.1 KB) Sergey Ivanovskiy, 03/20/2020 06:59 AM

4589_6.patch Magnifier (12.3 KB) Sergey Ivanovskiy, 03/20/2020 02:02 PM


Related issues

Related to User Interface - Bug #4598: define shared menu statement is converted using new name to reference the shared menu New

History

#2 Updated by Greg Shah about 4 years ago

  • Project changed from Bugs to User Interface
  • Subject changed from Menu case sensitivity and conversion to menu case sensitivity and conversion
  • Assignee set to Sergey Ivanovskiy

#3 Updated by Sergey Ivanovskiy about 4 years ago

Compiling of testcases/uast/submenu_case-sensitive.p with 4231b (rev 11376) failed

compile:
    [javac] Compiling 18 source files to /home/sbi/projects/testcases/uast/build/classes
    [javac] /home/sbi/projects/testcases/uast/src/com/goldencode/testcases/SubmenuCaseSensitive.java:33: error: cannot find symbol
    [javac]             new logical(true).setSensitive();
    [javac]                              ^
    [javac]   symbol:   method setSensitive()
    [javac]   location: class logical
    [javac] 1 error

BUILD FAILED
/home/sbi/projects/testcases/uast/build.xml:190: Compile failed; see the compiler error output for details.

#4 Updated by Roger Borrello about 4 years ago

If you change thissubmenu:SENSITIVE to ThisSUBMENU:SENSITIVE it will generate the correct results.

#5 Updated by Sergey Ivanovskiy about 4 years ago

Thank you, I see it now.

#6 Updated by Sergey Ivanovskiy about 4 years ago

According to this 4GL UI test:

define sub-menu ThisSUBMENU 
       menu-item quitItem label "Quit".
define menu thisMenu menubar 
       sub-menu ThisSUBMENU label "Menu".
define frame f1.

/*
do with frame f1:
   sub-menu thissubmenu:SENSITIVE = false.
end.
*/

menu-item quititem:SENSITIVE = false.

ASSIGN DEFAULT-WINDOW:MENUBAR
= MENU thismenu:HANDLE.

view frame f1.

wait-for close of this-procedure.

menu and menu item names are case insensitive.

#7 Updated by Roger Borrello about 4 years ago

There isn't a frame scoping the menu in the new case. That is what the customer's code is doing, so we need to understand what is different when it's scoped to a frame.

#8 Updated by Sergey Ivanovskiy about 4 years ago

I think that frame scoping is not connected with this issue because this example 4GL GUI works similarly on the native system

define sub-menu ThisSUBMENU 
       menu-item quitItem label "Quit".
define menu thisMenu menubar 
       sub-menu ThisSUBMENU label "Menu".
define frame f1.

do with frame f1:
   sub-menu thissubmenu:SENSITIVE = true.
   menu-item quititem:SENSITIVE = false.

end.

ASSIGN DEFAULT-WINDOW:MENUBAR
= MENU thismenu:HANDLE.

view frame f1.

wait-for close of this-procedure.

#9 Updated by Greg Shah about 4 years ago

I cannot think of ANY names in the 4GL that are case-sensitive. Our conversion needs to treat all menu, sub-menu and menu-item names case-insensitively. Whether or not the widget is in a frame, it does not matter.

#10 Updated by Roger Borrello about 4 years ago

Sergey Ivanovskiy wrote:

I think that frame scoping is not connected with this issue because this example 4GL GUI works similarly on the native system
[...]

To that point, the 4GL works just fine, and "thismenu" doesn't equal "thisMenu" if you are case-sensitive. But 4GL is very happy to process it.

FWD, however, isn't:

    [javac] /home/rfb/projects/VirtualBox-VMs/shared/projects/testcases/src/com/goldencode/testcases/SubmenuCaseSensitive.java:35: error: cannot find symbol
    [javac]             new logical(true).setSensitive();
    [javac]                              ^
    [javac]   symbol:   method setSensitive()
    [javac]   location: class logical
    [javac] /home/rfb/projects/VirtualBox-VMs/shared/projects/testcases/src/com/goldencode/testcases/SubmenuCaseSensitive.java:36: error: cannot find symbol
    [javac]             new logical(false).setSensitive();
    [javac]                               ^
    [javac]   symbol:   method setSensitive()
    [javac]   location: class logical
    [javac] 2 errors

#11 Updated by Sergey Ivanovskiy about 4 years ago

Roger, I tested this diff with 4231b patched. It couldn't convert menu-item quititem:SENSITIVE = false. properly but it could convert sub-menu thissubmenu:SENSITIVE = true. May be some widget_references.rules must be added for menu-item.

#12 Updated by Roger Borrello about 4 years ago

Sergey Ivanovskiy wrote:

Roger, I tested this diff with 4231b patched. It couldn't convert menu-item quititem:SENSITIVE = false. properly but it could convert sub-menu thissubmenu:SENSITIVE = true. May be some widget_references.rules must be added for menu-item.

I will apply and test.

Fortunately, the customer code only deals with sub-menu, so that is the only testcase I had. If you have a testcase for menu, we can check with Greg to see if it could be left as a TO-DO, or if he'd like you to continue on it.

I'll let you know how it fares against the customer code.

#13 Updated by Sergey Ivanovskiy about 4 years ago

Thank you. Please use this patch. It seems that it fixed menu-item according to my test.

#14 Updated by Roger Borrello about 4 years ago

Sergey Ivanovskiy wrote:

Thank you. Please use this patch. It seems that it fixed menu-item according to my test.

OK. Is that a patch applied to the patched files, or applied to the original files?

#15 Updated by Greg Shah about 4 years ago

Is this a complete fix for all known issues seen in this task?

#16 Updated by Roger Borrello about 4 years ago

I don't think it fixes the issue. The Javaname is now lowercase, but not found. Shouldn't it be a converted name?

    [javac]             menuBarWWin.mngoto.getSelf().findMenuItem("mncreditnote").setSensitive(new logical(false));
    [javac]                        ^
    [javac]   symbol:   variable mngoto
    [javac]   location: variable menuBarWWin of type GstDh1MenuBarWWinMenu
    [javac] 98 errors

I saw the testcase compile, but this is the customer code. I will see what's different.

#17 Updated by Roger Borrello about 4 years ago

I updated the testcase to get the new failure:

define sub-menu ThisSUBMENU 
       menu-item quitItem label "Quit".
define menu thisMenu menubar 
       sub-menu ThisSUBMENU label "Menu".
define frame f1.

do with frame f1:
   sub-menu thissubmenu:SENSITIVE = true.
   menu-item quititem:SENSITIVE = false.
end.

MENU-ITEM quitItem:SENSITIVE IN MENU ThisSUBMENU = FALSE.
MENU thismenu:SENSITIVE = false.

view frame f1.

wait-for close of this-procedure.

The IN MENU mnGoTo emits javaname that is wrong:

    [javac] /home/rfb/projects/VirtualBox-VMs/shared/projects/testcases/src/com/goldencode/testcases/SubmenuCaseSensitive.java:39: error: cannot find symbol
    [javac]          thisMenu.thissubmenu.getSelf().findMenuItem("quititem").setSensitive(new logical(false));
    [javac]                  ^
    [javac]   symbol:   variable thissubmenu
    [javac]   location: variable thisMenu of type SubmenuCaseSensitiveThisMenuMenu
    [javac] 1 error

Previously it emitted:
thisMenu.thisSubmenu.getSelf().findMenuItem("quitItem").setSensitive(new logical(false));

#18 Updated by Sergey Ivanovskiy about 4 years ago

It seems that the sub menu name from its definition should be here, but the converted name can use lower and upper cases. Obviously, it needs to prepare good set of test cases with usages of static and dynamic menu widgets.

#19 Updated by Sergey Ivanovskiy about 4 years ago

I am investigating logs from my changes in rules/annotations/menu_scoping.rules because the rules are not clear for me.

#20 Updated by Roger Borrello about 4 years ago

Sergey Ivanovskiy wrote:

I am investigating logs from my changes in rules/annotations/menu_scoping.rules because the rules are not clear for me.

There may be some useful notes from Constantin in https://proj.goldencode.com/issues/4208#note-144

#21 Updated by Sergey Ivanovskiy about 4 years ago

Yes, I have similar questions.

I have only this way to collect all "javaname" annotations created for menus, submenus and menu items by variable_definitions.rules.
Greg, could you explain the meaning of names.convert that is used by menu_scoping.rules? For an example,

<action>sm = names.convert(smRef.text.toLowerCase(), names.variable)</action>

It is implemented by NameConverterWorker.Library.convert. The question is due to smRef.text.toLowerCase() is a name of submenu given in lowercase. Is the returned value related to "javaname" annotation?

#22 Updated by Greg Shah about 4 years ago

  • 4GL names are always case-insensitive. Java names are always case-sensitive. So we must handle this at conversion time.
  • 4GL names can include characters which are invalid in Java names. The hypen - is an example.
  • names is a reference to the NameConverterWorker which uses the NameConverter to convert 4GL names into valid Java names.
  • There is a type of each conversion. Class names are camel-cased and start with a capital letter. Method names are camel-cased and start with a lowercased letter. You can look inside the NameConverter for details. In your example, the name will be converted as a variable name.

One thing that seems very wrong in the menu_scoping.rules is how often we are using the name converter. This makes no sense. Normally, we convert once at the place where the resource has a static definition (e.g. DEFINE VARIABLE or DEFINE MENU) and store it in the javaname annotation for later usage. If we need to refer to that javaname in other places, we normally do so by storing a refid annotation which links each usage location with the original definition, from which we can read the javaname.

#23 Updated by Sergey Ivanovskiy about 4 years ago

It is interesting what tests from testcases/uast/menu/ should be passed with the trunc version now. I found that my conception didn't work with testcases/uast/menu/win_menu_bar_submenu_same.p because it is an example of menu item and sub menu with the same name.

#24 Updated by Roger Borrello about 4 years ago

Sergey Ivanovskiy wrote:

It is interesting what tests from testcases/uast/menu/ should be passed with the trunc version now. I found that my conception didn't work with testcases/uast/menu/win_menu_bar_submenu_same.p because it is an example of menu item and sub menu with the same name.

Should I apply the patch to the 4231b reverted files? Greg, if the customer code does not have that use case Sergey mentioned of same name for menu-item and sub-menu, can we leave a TODO, or should Sergey continue looking?

#25 Updated by Sergey Ivanovskiy about 4 years ago

Roger, the last changes fixed your test case but these changes to use low case identifier are not correct. There is another idea to create submenu or menu item keys using the knowledge about its parents if these data are collected at the moment. If I understand this issue correctly, then it needs to identify menu, submenu and menu items with its menu and submenu definitions, then it is possible to use javaname that was assigned by variable_definition rules. In the code there are some comments about unqualified submenus and menu items that needs to be followed.

#26 Updated by Sergey Ivanovskiy about 4 years ago

The following 3 types of exceptions were encountered with the last attached diff.
These tests

#./menu/chui_menu_bar_same.p
#./menu/chui_menu_popup_same.p
#./menu/empty_labels.p
#./menu/win_menu_bar_same.p
#./menu/win_menu_popup_same.p

failed with
     [java] EXPRESSION EXECUTION ERROR:
     [java] ---------------------------
     [java] uiStrings.add(label)
     [java]           ^  { java.lang.NullPointerException }
     [java] ---------------------------
     [java] ERROR:
     [java] com.goldencode.p2j.pattern.TreeWalkException: ERROR!  Active Rule:
     [java] -----------------------
     [java]       RULE REPORT      
     [java] -----------------------
     [java] Rule Type :   WALK
     [java] Source AST:  [ menu-item ] BLOCK/STATEMENT/DEFINE_SUB_MENU/KW_MENU_ITM/ @4:3 {103079215121}
     [java] Copy AST  :  [ menu-item ] BLOCK/STATEMENT/DEFINE_SUB_MENU/KW_MENU_ITM/ @4:3 {103079215121}
     [java] Condition :  uiStrings.add(label)
     [java] Loop      :  false
     [java] --- END RULE REPORT ---
     [java] 
     [java] 
     [java] 
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1070)
     [java]     at com.goldencode.p2j.convert.TransformDriver.processTrees(TransformDriver.java:563)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.generateMenus(ConversionDriver.java:774)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.back(ConversionDriver.java:581)
     [java]     at com.goldencode.p2j.convert.TransformDriver.executeJob(TransformDriver.java:906)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:1022)
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:11 [KW_MENU_ITM id=103079215121]
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:275)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:210)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.apply(PatternEngine.java:1633)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1531)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1479)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1034)
     [java]     ... 5 more
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:11
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:484)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:497)
     [java]     at com.goldencode.p2j.pattern.Rule.executeActions(Rule.java:745)
     [java]     at com.goldencode.p2j.pattern.Rule.coreProcessing(Rule.java:712)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:534)
     [java]     at com.goldencode.p2j.pattern.RuleContainer.apply(RuleContainer.java:585)
     [java]     at com.goldencode.p2j.pattern.RuleSet.apply(RuleSet.java:98)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:262)
     [java]     ... 10 more
     [java] Caused by: java.lang.NullPointerException
     [java]     at java.util.TreeMap.compare(TreeMap.java:1294)
     [java]     at java.util.TreeMap.put(TreeMap.java:538)
     [java]     at java.util.TreeSet.add(TreeSet.java:255)
     [java]     at com.goldencode.expr.CE10578.execute(Unknown Source)
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:391)
     [java]     ... 17 more

and these ones
#./menu/references.p
#./menu/shared_use.p
#./menu/submenus.p

failed with this exception type
compile:
    [javac] Compiling 28 source files to /home/sbi/projects/testcases/uast/build/classes
    [javac] /home/sbi/projects/testcases/uast/src/com/goldencode/testcases/menu/SharedUse.java:17: error: cannot find symbol
    [javac]    SharedUseMmMenu mm = MenuWidget.importStaticSharedMenu(SharedUseMmMenu.class, "mm");
    [javac]    ^
    [javac]   symbol:   class SharedUseMmMenu
    [javac]   location: class SharedUse
    [javac] /home/sbi/projects/testcases/uast/src/com/goldencode/testcases/menu/References.java:30: error: cannot find symbol
    [javac]          m.smd.getSelf().findSubMenu("sm").setLabel(m.smd.smd.getSelf().findSubMenu("sm"), new character("SSMM"));
    [javac]                                                          ^
    [javac]   symbol:   variable smd
    [javac]   location: variable smd of type ReferencesSmdSubMenu
    [javac] /home/sbi/projects/testcases/uast/src/com/goldencode/testcases/menu/SharedUse.java:17: error: cannot find symbol
    [javac]    SharedUseMmMenu mm = MenuWidget.importStaticSharedMenu(SharedUseMmMenu.class, "mm");
    [javac]                                                           ^
    [javac]   symbol:   class SharedUseMmMenu
    [javac]   location: class SharedUse
    [javac] /home/sbi/projects/testcases/uast/src/com/goldencode/testcases/menu/Submenus.java:104: error: cannot find symbol
    [javac]          registerTrigger(new EventList("menu-drop", mbar.move.getSelf().findSubMenu("topic"), mbar.move.move.getSelf().findSubMenu("topic")), Submenus.this, new Trigger((Body) () -> 
    [javac]                                                                                                        ^
    [javac]   symbol:   variable move
    [javac]   location: variable move of type SubmenusMoveSubMenu
    [javac] 4 errors

BUILD FAILED

but these tests
#./menu/menu_title_color_attributes.p
#./menu/popup_menu_title_color_attributes.p

failed with this exception type
     [java] ./menu/popup_menu_title_color_attributes.p
     [java] Elapsed job time:  00:00:04.860
     [java] EXPRESSION EXECUTION ERROR:
     [java] ---------------------------
     [java] throwException(errmsg)
     [java] ^  { Unsupported method or attribute KW_TITL_BGC. [COLON id <214748365042> 41:19] }
     [java] ---------------------------
     [java] ERROR:
     [java] com.goldencode.p2j.pattern.TreeWalkException: ERROR!  Active Rule:
     [java] -----------------------
     [java]       RULE REPORT      
     [java] -----------------------
     [java] Rule Type :   DESCENT
     [java] Source AST:  [ : ] BLOCK/ASSIGNMENT/ASSIGN/EXPRESSION/COLON/ @41:19 {214748365042}
     [java] Copy AST  :  [ : ] BLOCK/ASSIGNMENT/ASSIGN/EXPRESSION/COLON/ @41:19 {214748365042}
     [java] Condition :  throwException(errmsg)
     [java] Loop      :  false
     [java] --- END RULE REPORT ---
     [java] 
     [java] 
     [java] 
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1070)
     [java]     at com.goldencode.p2j.convert.TransformDriver.processTrees(TransformDriver.java:563)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.back(ConversionDriver.java:590)
     [java]     at com.goldencode.p2j.convert.TransformDriver.executeJob(TransformDriver.java:906)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:1022)
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:1 [COLON id=214748365042]
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:275)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:210)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.apply(PatternEngine.java:1633)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1531)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1479)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1034)
     [java]     ... 4 more

and it looks expected.
The other tests from testcases/uast/menu are converted and compiled:
./menu/alt.p
./menu/ambiguity.p
./menu/but_handle.p
./menu/cases.p
./menu/children.p
./menu/chui_menu_2_purpose.p
./menu/chui_menu_bar_accelerator.p
./menu/chui_menu_bar.p
./menu/chui_menu_bar_submenu_same.p
./menu/chui_menu_popup_accelerator.p
./menu/chui_menu_popup.p
./menu/chui_menu_popup_submenu_same.p
./menu/chui_menu_popup_test_like.p
./menu/delete.p
./menu/disabled_enabled.p
./menu/dynamic1.p
./menu/dynamic.p
./menu/dyn_parent.p
./menu/fmenu.p
./menu/frame.p
./menu/frames1.p
./menu/frames.p
./menu/gui_menubar_trigger.p
./menu/keycode.p
./menu/like_exm.p
./menu/like_m.p
./menu/like_simple.p
./menu/like_sm.p
./menu/menu1.p
./menu/menubar_no_endkey.p
./menu/menubar.p
./menu/menu_drop.p
./menu/menu_drop_woio.p
./menu/menuevents.p
./menu/menuitems1.p
./menu/menuitems.p
./menu/menu_mouse.p
./menu/menu_sizes.p
./menu/mix.p
./menu/mnemlast.p
./menu/mnemonic.p
./menu/npe.p
./menu/popup_ext.p
./menu/popup_simple_npe.p
./menu/popup_simple.p
./menu/reference1.p
./menu/semicolon.p
./menu/shared_new.p
./menu/simple_frame.p
./menu/simple_mi.p
./menu/simple.p
./menu/simple_sm1.p
./menu/simple_sm.p
./menu/sm_mnemonic.p
./menu/togglebox.p
./menu/triggers.p
./menu/umbiguity.p
./menu/win_menu_2_purpose.p
./menu/win_menu_bar_accelerator.p
./menu/win_menu_bar.p
./menu/win_menu_bar_submenu_same.p
./menu/win_menu_popup_accelerator.p
./menu/win_menu_popup.p
./menu/win_menu_popup_submenu_same.p

Working to fix
#./menu/references.p
#./menu/shared_use.p
#./menu/submenus.p

#27 Updated by Roger Borrello about 4 years ago

It seems like you are getting close. Keep up the good work. If you need a hand on anything, please post.

#28 Updated by Sergey Ivanovskiy about 4 years ago

These files

./menu/references.p
./menu/shared_use.p
./menu/submenus.p

are converted with the trunc version incorrectly too:
compile:
    [javac] Compiling 28 source files to /home/sbi/projects/testcases/uast/build/classes
    [javac] /home/sbi/projects/testcases/uast/src/com/goldencode/testcases/menu/SharedUse.java:17: error: cannot find symbol
    [javac]    SharedUseMmMenu mm = MenuWidget.importStaticSharedMenu(SharedUseMmMenu.class, "mm");
    [javac]    ^
    [javac]   symbol:   class SharedUseMmMenu
    [javac]   location: class SharedUse
    [javac] /home/sbi/projects/testcases/uast/src/com/goldencode/testcases/menu/References.java:30: error: cannot find symbol
    [javac]          m.smd.getSelf().findSubMenu("sm").setLabel(m.smd.smd.getSelf().findSubMenu("sm"), new character("SSMM"));
    [javac]                                                          ^
    [javac]   symbol:   variable smd
    [javac]   location: variable smd of type ReferencesSmdSubMenu
    [javac] /home/sbi/projects/testcases/uast/src/com/goldencode/testcases/menu/SharedUse.java:17: error: cannot find symbol
    [javac]    SharedUseMmMenu mm = MenuWidget.importStaticSharedMenu(SharedUseMmMenu.class, "mm");
    [javac]                                                           ^
    [javac]   symbol:   class SharedUseMmMenu
    [javac]   location: class SharedUse
    [javac] /home/sbi/projects/testcases/uast/src/com/goldencode/testcases/menu/Submenus.java:104: error: cannot find symbol
    [javac]          registerTrigger(new EventList("menu-drop", mbar.move.getSelf().findSubMenu("topic"), mbar.move.move.getSelf().findSubMenu("topic")), Submenus.this, new Trigger((Body) () -> 
    [javac]                                                                                                        ^
    [javac]   symbol:   variable move
    [javac]   location: variable move of type SubmenusMoveSubMenu
    [javac] 4 errors

BUILD FAILED

Thus my changes don't regress them.

#29 Updated by Sergey Ivanovskiy about 4 years ago

I encountered a strange annotation generated for menu item

<annotation datatype="java.util.ArrayList" key="label">
            <listitem datatype="java.lang.String" value="&quot;&quot;"/>
</annotation>

in this ast
       <ast col="4" id="12884901978" line="14" text="menu-item" type="KW_MENU_ITM">
          <annotation datatype="java.lang.String" key="name" value="empty2"/>
          <annotation datatype="java.lang.Long" key="type" value="430"/>
          <annotation datatype="java.util.ArrayList" key="label">
            <listitem datatype="java.lang.String" value="&quot;&quot;"/>
          </annotation>
          <annotation datatype="java.lang.Boolean" key="widdef" value="true"/>
          <annotation datatype="java.lang.String" key="javaname" value="empty2"/>
          <ast col="14" id="12884901980" line="14" text="empty2" type="SYMBOL"/>
          <ast col="21" id="12884901982" line="14" text="label" type="KW_LABEL">
            <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
            <ast col="27" id="12884901984" line="14" text="&quot;&quot;" type="STRING">
              <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
            </ast>
          </ast>
        </ast>

that produces this exception
[java] Frame Generator
     [java] ------------------------------------------------------------------------------
     [java] 
     [java] ./menu/win_menu_bar_same.p
     [java] Elapsed job time:  00:00:00.390
     [java] 
     [java] ------------------------------------------------------------------------------
     [java] Menu Generator
     [java] ------------------------------------------------------------------------------
     [java] 
     [java] ./menu/win_menu_bar_same.p
     [java] Creating separate file: WinMenuBarSameSameSubMenu ./menu/WinMenuBarSameSameSubMenu
     [java] Elapsed job time:  00:00:00.081
     [java] EXPRESSION EXECUTION ERROR:
     [java] ---------------------------
     [java] uiStrings.add(label)
     [java]           ^  { java.lang.NullPointerException }
     [java] ---------------------------
     [java] ERROR:
     [java] com.goldencode.p2j.pattern.TreeWalkException: ERROR!  Active Rule:
     [java] -----------------------
     [java]       RULE REPORT      
     [java] -----------------------
     [java] Rule Type :   WALK
     [java] Source AST:  [ menu-item ] BLOCK/STATEMENT/DEFINE_SUB_MENU/KW_MENU_ITM/ @13:4 {12884901974}
     [java] Copy AST  :  [ menu-item ] BLOCK/STATEMENT/DEFINE_SUB_MENU/KW_MENU_ITM/ @13:4 {12884901974}
     [java] Condition :  uiStrings.add(label)
     [java] Loop      :  false
     [java] --- END RULE REPORT ---
     [java] 
     [java] 
     [java] 
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1070)
     [java]     at com.goldencode.p2j.convert.TransformDriver.processTrees(TransformDriver.java:563)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.generateMenus(ConversionDriver.java:774)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.back(ConversionDriver.java:581)
     [java]     at com.goldencode.p2j.convert.TransformDriver.executeJob(TransformDriver.java:906)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:1022)
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:11 [KW_MENU_ITM id=12884901974]
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:275)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:210)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.apply(PatternEngine.java:1633)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1531)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1479)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1034)
     [java]     ... 5 more
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:11
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:484)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:497)
     [java]     at com.goldencode.p2j.pattern.Rule.executeActions(Rule.java:745)
     [java]     at com.goldencode.p2j.pattern.Rule.coreProcessing(Rule.java:712)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:534)
     [java]     at com.goldencode.p2j.pattern.RuleContainer.apply(RuleContainer.java:585)
     [java]     at com.goldencode.p2j.pattern.RuleSet.apply(RuleSet.java:98)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:262)
     [java]     ... 10 more
     [java] Caused by: java.lang.NullPointerException
     [java]     at java.util.TreeMap.put(TreeMap.java:563)
     [java]     at java.util.TreeSet.add(TreeSet.java:255)
     [java]     at com.goldencode.expr.CE9272.execute(Unknown Source)
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:391)
     [java]     ... 17 more

BUILD FAILED

Working on this part too.

#30 Updated by Sergey Ivanovskiy about 4 years ago

This diff 4589_6.patch fixed these tests (see #4589-28)

./menu/references.p
./menu/submenus.p

but
./menu/shared_use.p

has another root cause that is incorrect resolution of the shared menu name. Please look at these two simple tests: ./menu/shared_new.p and ./menu/shared_use.p.
May be this issue could be easily fixed?
Where the code of shared_new.p is this one
define new shared menu mm title "Menu title".

run "shared_use.p" 

and the code of shared_use.p is
define shared menu mm.

message string(menu mm:title).

#31 Updated by Roger Borrello about 4 years ago

Are you getting a conversion error or runtime?

I've made a change to the shared_new.p to make is easier to run on both Linux and Win32. It is checked in.

define new shared menu mm title "Menu title".

def var path as char init "testcases/uast/menu/".
def var pname as char init "shared_use.p".
def var progname as char.
progname = "z:/" + path + pname.
if opsys = "unix" then
   progname = "~~" + path + progname.
if opsys <> "win32" then
   message opsys "is an unsupported OS".
else
   run value(progname).
message "Done.".

#32 Updated by Sergey Ivanovskiy about 4 years ago

Committed revision 11381 (4231b) fixed case-insensitive issue for menu identifiers but the shared menu and labels issues are present in the trunc now. I am working to fix them #4589-29 and #4589-30.

Hynek, please review these changes 11381 (4231b) as you worked on the main menu conversion changes.

#33 Updated by Sergey Ivanovskiy about 4 years ago

Roger Borrello wrote:

Are you getting a conversion error or runtime?

This is the menu generation issue for shared menus because ./menu/shared_new.p and ./menu/shared_use.p are converted respectively into

package com.goldencode.testcases.menu;

import com.goldencode.p2j.util.*;
import com.goldencode.p2j.ui.*;
import com.goldencode.testcases.ui.menu.*;

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

/**
 * Business logic (converted to Java from the 4GL source code
 * in menu/shared_new.p).
 */
public class SharedNew
{
   SharedNewMmMenu mm = MenuWidget.createStaticSharedMenu(SharedNewMmMenu.class, "mm");

   /**
    * External procedure (converted to Java from the 4GL source code
    * in menu/shared_new.p).
    */
   public void execute()
   {
      externalProcedure(SharedNew.this, new Block((Body) () -> 
      {
         ControlFlowOps.invoke("shared_use.p");
      }));
   }
}

and
package com.goldencode.testcases.menu;

import com.goldencode.p2j.util.*;
import com.goldencode.p2j.ui.*;
import com.goldencode.testcases.ui.menu.*;

import static com.goldencode.p2j.util.BlockManager.*;
import static com.goldencode.p2j.util.character.*;
import static com.goldencode.p2j.ui.LogicalTerminal.*;

/**
 * Business logic (converted to Java from the 4GL source code
 * in menu/shared_use.p).
 */
public class SharedUse
{
   SharedUseMmMenu mm = MenuWidget.importStaticSharedMenu(SharedUseMmMenu.class, "mm");

   /**
    * External procedure (converted to Java from the 4GL source code
    * in menu/shared_use.p).
    */
   public void execute()
   {
      externalProcedure(SharedUse.this, new Block((Body) () -> 
      {
         message(valueOf(mm.getSelf().getTitle()));
      }));
   }
}

where SharedUseMmMenu.class should be SharedNewMmMenu.class. SharedUseMmMenu.java is not generated (correct because it is a menu reference of the shared menu defined in SharedNewMmMenu.java). Please correct if it is not true.

#34 Updated by Roger Borrello about 4 years ago

I converted/compiled the customer code with your 4589_6.patch updates. Excellent! Did you remove all your debug printfln statements before you checked in?

I spoke to Greg and he said for you to make a separate task for this last issue related to shared menus.

#35 Updated by Hynek Cihlar about 4 years ago

Sergey Ivanovskiy wrote:

where SharedUseMmMenu.class should be SharedNewMmMenu.class. SharedUseMmMenu.java is not generated (correct because it is a menu reference of the shared menu defined in SharedNewMmMenu.java). Please correct if it is not true.

Did you confirm this in native 4GL?

#36 Updated by Sergey Ivanovskiy about 4 years ago

Hynek Cihlar wrote:

Sergey Ivanovskiy wrote:

where SharedUseMmMenu.class should be SharedNewMmMenu.class. SharedUseMmMenu.java is not generated (correct because it is a menu reference of the shared menu defined in SharedNewMmMenu.java). Please correct if it is not true.

Did you confirm this in native 4GL?

Yes, if the propath is setup for this program shared_use.p, then shared_new.p is executed by Progress 4GL correctly (works properly)

define new shared menu mm title "Menu title".

run "shared_use.p" 

#37 Updated by Sergey Ivanovskiy about 4 years ago

Roger Borrello wrote:

I converted/compiled the customer code with your 4589_6.patch updates. Excellent! Did you remove all your debug printfln statements before you checked in?

I spoke to Greg and he said for you to make a separate task for this last issue related to shared menus.

I committed rev 11384 (4231b) that fixed menu keys and labels null pointer exceptions for these test cases:

./menu/chui_menu_bar_same.p
./menu/chui_menu_popup_same.p
./menu/empty_labels.p
./menu/win_menu_bar_same.p
./menu/win_menu_popup_same.p

Now they are converted and compiled.

#38 Updated by Roger Borrello about 4 years ago

I saw the Redmine entries about the regression, and I am grateful you found a better solution. The customer code still converts and compiles properly. Great work, thank you!

The shared menu is still broken, but secondary from my perspective, since the customer is not using shared menus.

#39 Updated by Greg Shah about 4 years ago

As long as the regression in the other customer's application is also fixed, then any remaining issues can be moved into new tasks.

Sergey: Please create the needed tasks and link them here as related.

#40 Updated by Sergey Ivanovskiy about 4 years ago

  • Related to Bug #4598: define shared menu statement is converted using new name to reference the shared menu added

#41 Updated by Sergey Ivanovskiy about 4 years ago

The code is still needed to fix ACCELERATOR assignments for menu. I added new test case test-accelerator-1.p into testcases/uast/menu. This test is broken now.

IF AVAILABLE acclrtrs THEN
MENU-ITEM m_Search:ACCELERATOR = acclrtrs.func_key.

The AST tree after applying annotation rules is
<ast col="0" id="12884902267" line="0" text="statement" type="STATEMENT">
      <ast col="1" id="12884902268" line="63" text="IF" type="KW_IF">
        <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
        <annotation datatype="java.lang.Long" key="peerid" value="120259084380"/>
        <ast col="0" id="12884902270" line="0" text="expression" type="EXPRESSION">
          <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
          <annotation datatype="java.lang.Long" key="peerid" value="120259084381"/>
          <ast col="4" id="12884902271" line="63" text="AVAILABLE" type="FUNC_LOGICAL">
            <annotation datatype="java.lang.Long" key="oldtype" value="531"/>
            <annotation datatype="java.lang.Boolean" key="builtin" value="true"/>
            <annotation datatype="java.lang.Boolean" key="returnsunknown" value="false"/>
            <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
            <annotation datatype="java.lang.Long" key="peerid" value="120259084382"/>
            <ast col="14" id="12884902273" line="63" text="acclrtrs" type="TEMP_TABLE">
              <annotation datatype="java.lang.String" key="schemaname" value="acclrtrs"/>
              <annotation datatype="java.lang.String" key="bufname" value="acclrtrs"/>
              <annotation datatype="java.lang.String" key="dbname" value=""/>
              <annotation datatype="java.lang.Long" key="recordtype" value="14"/>
              <annotation datatype="java.lang.Long" key="param_index" value="0"/>
              <annotation datatype="java.lang.String" key="bufrefkey" value="acclrtrs,acclrtrs,-1"/>
              <annotation datatype="java.lang.Long" key="bufreftype" value="21"/>
              <annotation datatype="java.lang.String" key="uniquename" value="acclrtrs_acclrtrs"/>
              <annotation datatype="java.lang.Long" key="refid" value="12884902309"/>
              <annotation datatype="java.lang.Long" key="peerid" value="120259084383"/>
            </ast>
          </ast>
        </ast>
        <ast col="23" id="12884902275" line="63" text="THEN" type="KW_THEN">
          <annotation datatype="java.lang.Long" key="peerid" value="120259084384"/>
          <ast col="0" id="12884902277" line="0" text="block" type="BLOCK">
            <annotation datatype="java.lang.Boolean" key="recordscoping" value="false"/>
            <annotation datatype="java.lang.Long" key="peerid" value="120259084385"/>
            <ast col="0" id="12884902278" line="0" text="assignment" type="ASSIGNMENT">
              <ast col="32" id="12884902279" line="64" text="=" type="ASSIGN">
                <annotation datatype="java.lang.Long" key="peerid" value="120259084386"/>
                <ast col="19" id="12884902282" line="64" text=":" type="COLON">
                  <ast col="1" id="12884902283" line="64" text="MENU-ITEM" type="KW_MENU_ITM">
                    <ast col="11" id="12884902285" line="64" text="m_Search" type="WID_MENU_ITM"/>
                  </ast>
                  <ast col="20" id="12884902286" line="64" text="ACCELERATOR" type="ATTR_CHAR">
                    <annotation datatype="java.lang.Long" key="oldtype" value="936"/>
                    <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
                  </ast>
                </ast>
                <ast col="0" id="12884902287" line="0" text="expression" type="EXPRESSION">
                  <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
                  <ast col="34" id="12884902288" line="64" text="acclrtrs.func_key" type="FIELD_CHAR">
                    <annotation datatype="java.lang.Long" key="oldtype" value="6"/>
                    <annotation datatype="java.lang.String" key="schemaname" value="acclrtrs.func_key"/>
                    <annotation datatype="java.lang.String" key="bufname" value="acclrtrs"/>
                    <annotation datatype="java.lang.String" key="dbname" value=""/>
                    <annotation datatype="java.lang.Long" key="recordtype" value="14"/>
                    <annotation datatype="java.lang.String" key="name" value="acclrtrs.func_key"/>
                    <annotation datatype="java.lang.Long" key="type" value="402"/>
                    <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
                    <annotation datatype="java.lang.Boolean" key="is_meta" value="false"/>
                    <annotation datatype="java.lang.String" key="fieldname" value="funcKey"/>
                    <annotation datatype="java.lang.String" key="bufrefkey" value="acclrtrs,acclrtrs,-1"/>
                    <annotation datatype="java.lang.Long" key="bufreftype" value="21"/>
                    <annotation datatype="java.lang.String" key="uniquename" value="acclrtrs_acclrtrs"/>
                    <annotation datatype="java.lang.Long" key="refid" value="12884902309"/>
                    <annotation datatype="java.lang.String" key="methodtxt" value="getFuncKey"/>
                    <annotation datatype="java.lang.Long" key="peerid" value="120259084387"/>
                  </ast>
                </ast>
              </ast>
            </ast>
          </ast>
        </ast>
      </ast>
    </ast>

#42 Updated by Sergey Ivanovskiy about 4 years ago

This code

MENU-ITEM m_Search:SENSITIVE = false.

is broken too. Working on this case too.

#43 Updated by Sergey Ivanovskiy about 4 years ago

The AST of menu item in the assignment expression #4589-41 missed <annotation datatype="java.lang.String" key="in_wid_menu" .../>

#44 Updated by Sergey Ivanovskiy about 4 years ago

Sergey Ivanovskiy wrote:

The AST of menu item in the assignment expression #4589-41 missed <annotation datatype="java.lang.String" key="in_wid_menu" .../>

Please review. It was fixed in rev 11387 (4231b) according to standalone tests from testcases/uast/menu.

#45 Updated by Hynek Cihlar about 4 years ago

Sergey, I think I stepped on another error during <large_app> conversion caused by the menu changes.

    [java] ./abl/skeleton/dotnet/ADODB/AffectEnum.cls
     [java] Elapsed job time:  00:00:14.018
     [java] EXPRESSION EXECUTION ERROR:
     [java] ---------------------------
     [java] proname = getNoteString("name").toLowerCase()
     [java]                                 ^  { java.lang.NullPointerException }
     [java] ---------------------------
     [java] EXPRESSION EXECUTION ERROR:
     [java] ---------------------------
     [java] execLib("create_javaname")
     [java] ^  { Expression execution error @1:33 }
     [java] ---------------------------
     [java] ERROR:
     [java] com.goldencode.p2j.pattern.TreeWalkException: ERROR!  Active Rule:
     [java] -----------------------
     [java]       RULE REPORT      
     [java] -----------------------
     [java] Rule Type :   WALK
     [java] Source AST:  [ adAffectCurrent ] BLOCK/ENUM_DEF/BLOCK/DEFINE_ENUM/EQUALS/ENUM_VALUE/ @4:7 {146028888080}
     [java] Copy AST  :  [ adAffectCurrent ] BLOCK/ENUM_DEF/BLOCK/DEFINE_ENUM/EQUALS/ENUM_VALUE/ @4:7 {146028888080}
     [java] Condition :  proname = getNoteString("name").toLowerCase()
     [java] Loop      :  false
     [java] --- END RULE REPORT ---
     [java] 
     [java] 
     [java] 
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1070)
     [java]     at com.goldencode.p2j.convert.TransformDriver.processTrees(TransformDriver.java:563)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.back(ConversionDriver.java:565)
     [java]     at com.goldencode.p2j.convert.TransformDriver.executeJob(TransformDriver.java:906)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:1022)
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:1 [ENUM_VALUE id=146028888080]
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:275)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:210)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.apply(PatternEngine.java:1633)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1531)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1479)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1034)
     [java]     ... 4 more
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:1
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:484)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:497)
     [java]     at com.goldencode.p2j.pattern.Rule.executeActions(Rule.java:745)
     [java]     at com.goldencode.p2j.pattern.Rule.coreProcessing(Rule.java:712)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:534)
     [java]     at com.goldencode.p2j.pattern.RuleContainer.apply(RuleContainer.java:585)
     [java]     at com.goldencode.p2j.pattern.RuleSet.apply(RuleSet.java:98)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:262)
     [java]     ... 9 more
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:33
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:484)
     [java]     at com.goldencode.p2j.pattern.Rule.apply(Rule.java:497)
     [java]     at com.goldencode.p2j.pattern.NamedFunction.execute(NamedFunction.java:450)
     [java]     at com.goldencode.p2j.pattern.AstSymbolResolver.execute(AstSymbolResolver.java:712)
     [java]     at com.goldencode.p2j.pattern.CommonAstSupport$Library.execLib(CommonAstSupport.java:1678)
     [java]     at com.goldencode.expr.CE8336.execute(Unknown Source)
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:391)
     [java]     ... 16 more
     [java] Caused by: java.lang.NullPointerException
     [java]     at com.goldencode.expr.CE8337.execute(Unknown Source)
     [java]     at com.goldencode.expr.Expression.execute(Expression.java:391)
     [java]     ... 22 more

#46 Updated by Greg Shah about 4 years ago

This is not a problem with menu conversion. The skeletons should never be converted. They are supposed to be excluded from conversion (in the ignore list). Make sure you convert with the blacklist.

#47 Updated by Hynek Cihlar about 4 years ago

Hynek Cihlar wrote:

Sergey, I think I stepped on another error during <large_app> conversion caused by the menu changes.

Sorry, false alarm.

#48 Updated by Hynek Cihlar about 4 years ago

Greg Shah wrote:

This is not a problem with menu conversion. The skeletons should never be converted. They are supposed to be excluded from conversion (in the ignore list). Make sure you convert with the blacklist.

Yes, this was the issue.

#49 Updated by Greg Shah about 4 years ago

Code Review Task Branch 4231b Revision 11387

It seems wrong to use the javaname (even a lowercased one) as a key to the map of javanames for sub-menus. For menus it seems that we use the lowercased 4GL name as the key. This seems correct. The sub-menu approach seems wrong.

#50 Updated by Sergey Ivanovskiy about 4 years ago

Greg, I compared the previous version and the current changes and found that this map used submenu = names.convert(text, names.variable) for submenu keys and the new changes shouldn't change it because the result of find_sm_menu is important to be javaname especially when it uses these compound patterns name1[.name2][.name3] for menu java names. For an example in this rule

         <action>menu = execLib("find_sm_menu", names.convert(text.toLowerCase(), names.variable))</action>
         <!--<action>printfln("%s = execLib('find_sm_menu', names.convert(%s, names.variable))", menu, text.toLowerCase())</action>-->
         <rule>menu != null
            <action>putNote("first-menu-path", menu)</action>
            <action>putNote("in_wid_menu", menu)</action>
         </rule>

Please look at this part of changes. These new changes continue to use javaname as menu and submenu keys
@@ -169,16 +190,17 @@
       <rule>type == prog.wid_sub_menu and
             parent.type == prog.kw_sub_menu 

-         <action>submenu = names.convert(text, names.variable)</action>
- 
+         <action>submenu = names.convert(text.toLowerCase(), names.variable)</action>
+         <!--<action>printfln("%s = names.convert(%s, names.variable)", submenu, text.toLowerCase())</action>-->
+         <action>menukey = submenu.toLowerCase()</action>
          <rule>parent.parent != null and
                (parent.parent.type == prog.define_menu or
                parent.parent.type == prog.define_sub_menu) and 
-               !sm_menus.containsKey(submenu) 
+               !sm_menus.containsKey(menukey) 
             <action>menu = parent.parent.getAnnotation("name")</action>
             <action>menu = names.convert(menu, names.variable)</action>
-            <!--<action>printfln("adding %s to %s", submenu, menu)</action>-->
-            <action>sm_menus.put(submenu, menu)</action>
+            <!--<action>printfln("key %s, adding %s to %s", menukey, submenu, menu)</action>-->
+            <action>sm_menus.put(menukey, menu)</action>
          </rule>

       </rule>
@@ -191,19 +213,30 @@

The following code are the find_sm_menu changes
@@ -119,12 find_sm_menu+126,18 @@
          <return    name="cur"   type="java.lang.String" />

          <rule>true
-            <action>parnt = sm_menus.get(sm)</action>
+            <action>menukey = sm.toLowerCase()</action>
+            <action>parnt = sm_menus.get(menukey)</action>
+            <!--<action>printfln("find_sm_menu-> %s = sm_menus.get(%s)", parnt, menukey)</action>-->
             <action>cur = parnt</action>
-            <while>parnt != null and sm_menus.containsKey(parnt)
-               <!--<action>printfln("parnt: %s, sm_menus.get(parnt): %s", parnt, sm_menus.get(parnt))</action>-->
-               <action>cur = sprintf("%s.%s", sm_menus.get(parnt), parnt)</action>
-               <action>parnt = sm_menus.get(parnt)</action>
+            <while>parnt != null
+               <action>menukey = parnt.toLowerCase()</action>
+               <rule>sm_menus.containsKey(menukey)
+                  <!--<action>printfln("parnt: %s, sm_menus.get(parnt): %s", parnt, sm_menus.get(menukey))</action>-->
+                  <action>cur = sprintf("%s.%s", sm_menus.get(menukey), parnt)</action>
+                  <action>parnt = sm_menus.get(menukey)</action>
+                  <action on="false">parnt = null</action>
+               </rule>
             </while>
          </rule>
       </function>
@@ -135,7 +148,8 @@

#51 Updated by Greg Shah about 4 years ago

If everything is working so far and there are no regressions, then I am OK with it.

#52 Updated by Sergey Ivanovskiy about 4 years ago

The current changes were checked with testcases/uast/menu tests that passed except 4 known cases:

./menu/menu_title_color_attributes.p
./menu/popup_menu_title_color_attributes.p

failed with this exception type
     [java] ./menu/popup_menu_title_color_attributes.p
     [java] Elapsed job time:  00:00:04.860
     [java] EXPRESSION EXECUTION ERROR:
     [java] ---------------------------
     [java] throwException(errmsg)
     [java] ^  { Unsupported method or attribute KW_TITL_BGC. [COLON id <214748365042> 41:19] }
     [java] ---------------------------
     [java] ERROR:
     [java] com.goldencode.p2j.pattern.TreeWalkException: ERROR!  Active Rule:
     [java] -----------------------
     [java]       RULE REPORT      
     [java] -----------------------
     [java] Rule Type :   DESCENT
     [java] Source AST:  [ : ] BLOCK/ASSIGNMENT/ASSIGN/EXPRESSION/COLON/ @41:19 {214748365042}
     [java] Copy AST  :  [ : ] BLOCK/ASSIGNMENT/ASSIGN/EXPRESSION/COLON/ @41:19 {214748365042}
     [java] Condition :  throwException(errmsg)
     [java] Loop      :  false
     [java] --- END RULE REPORT ---
     [java] 
     [java] 
     [java] 
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1070)
     [java]     at com.goldencode.p2j.convert.TransformDriver.processTrees(TransformDriver.java:563)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.back(ConversionDriver.java:590)
     [java]     at com.goldencode.p2j.convert.TransformDriver.executeJob(TransformDriver.java:906)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:1022)
     [java] Caused by: com.goldencode.expr.ExpressionException: Expression execution error @1:1 [COLON id=214748365042]
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:275)
     [java]     at com.goldencode.p2j.pattern.AstWalker.walk(AstWalker.java:210)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.apply(PatternEngine.java:1633)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1531)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.processAst(PatternEngine.java:1479)
     [java]     at com.goldencode.p2j.pattern.PatternEngine.run(PatternEngine.java:1034)
     [java]     ... 4 more

and for these ./menu/shared_new.p and ./menu/shared_use.p there was created #4598.

#53 Updated by Greg Shah about 4 years ago

The current changes were checked with testcases/uast/menu tests that passed except 4 known cases:

Roger is working on #4393 which will resolve these.

#54 Updated by Greg Shah almost 4 years ago

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

Task branch 4231b has been merged to trunk as revision 11347.

Also available in: Atom PDF