From 2c9461126f7fdeafa420aa00c95d3a298b8c2c7f Mon Sep 17 00:00:00 2001 From: codemanyak Date: Wed, 28 Feb 2024 17:29:19 +0100 Subject: [PATCH 01/12] Version numbers prepared for bugfixing towards 3.32-17 --- buildapp.xml | 4 +- .../fisch/structorizer/elements/Element.java | 4 +- src/lu/fisch/structorizer/gui/changelog.txt | 3 +- src/lu/fisch/structorizer/locales/pt_br.txt | 42 ++++++++++--------- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/buildapp.xml b/buildapp.xml index 261341d9..3a52f544 100644 --- a/buildapp.xml +++ b/buildapp.xml @@ -15,8 +15,8 @@ name="Structorizer" displayname="Structorizer" identifier="lu.fisch.Structorizer" - shortversion="3.32-16" - version="3.32-16" + shortversion="3.32-17" + version="3.32-17" icon="icons/Structorizer.icns" mainclassname="Structorizer" copyright="Bob Fisch" diff --git a/src/lu/fisch/structorizer/elements/Element.java b/src/lu/fisch/structorizer/elements/Element.java index ca4988cc..e9460302 100644 --- a/src/lu/fisch/structorizer/elements/Element.java +++ b/src/lu/fisch/structorizer/elements/Element.java @@ -306,7 +306,7 @@ public String toString() public static final long E_HELP_FILE_SIZE = 12300000; public static final String E_DOWNLOAD_PAGE = "https://www.fisch.lu/Php/download.php"; // END KGU#791 2020-01-20 - public static final String E_VERSION = "3.32-16"; + public static final String E_VERSION = "3.32-17"; public static final String E_THANKS = "Developed and maintained by\n"+ " - Robert Fisch \n"+ @@ -352,7 +352,7 @@ public String toString() " - DE: Klaus-Peter Reimers \n"+ " - LU: Laurent Zender \n"+ " - ES: Andres Cabrera \n"+ - " - PT/BR: Theldo Cruz \n"+ + " - PT/BR: Theldo Cruz Franqueiro \n"+ " - IT: Andrea Maiani , A. Simonetta (University of Rome Tor Vergata)\n"+ " - ZH-CN: Wang Lei \n"+ " - ZH-TW: Joe Chem \n"+ diff --git a/src/lu/fisch/structorizer/gui/changelog.txt b/src/lu/fisch/structorizer/gui/changelog.txt index 16cbcf90..a22807a8 100644 --- a/src/lu/fisch/structorizer/gui/changelog.txt +++ b/src/lu/fisch/structorizer/gui/changelog.txt @@ -23,7 +23,7 @@ Known issues (also see https://github.com/fesch/Structorizer.Desktop/issues): - ARM export is still experimental and relies on a specific and very restricted syntax for the element contents in order to produce meaningful results. -Current development version 3.32-16 (2024-02-28) +Current development version 3.32-17 (2024-02-28) - 01: Bugfix #987: Duplicate subroutine comment export by Pascal generator <2> - 01: Bugfix #988: Syntax error in Structorizer.bat and Arranger.bat fixed <2> - 01: Bugfix #989: Expressions in EXIT elements (e.g. return) were forgotten @@ -194,6 +194,7 @@ Current development version 3.32-16 (2024-02-28) - 16: Bugfix #1126: Spanish and Italian messages for View menu were missing, the attempt to open Translator led to an error abort. <2> - 16: Completion and corrections of the Portuguese/Brazilian locale +- 17: Version 3.32 (2021-09-19) requiring Java 11 or newer - 01: Bugfix #851/2: SPECIAL-NAMES sections caused COBOL parser abort <2> diff --git a/src/lu/fisch/structorizer/locales/pt_br.txt b/src/lu/fisch/structorizer/locales/pt_br.txt index 51e8fe1c..591bb657 100644 --- a/src/lu/fisch/structorizer/locales/pt_br.txt +++ b/src/lu/fisch/structorizer/locales/pt_br.txt @@ -38,7 +38,7 @@ /****************************************************************************************************** * - * Author: PUC-Minas, MG - Brasil + * Author: PUC-Minas, MG - Brasil (Theldo Cruz Franqueiro) * * Description: The Brazilian Portuguese (PT-BR) language file * @@ -46,24 +46,26 @@ * * Revision List * - * Author Date Description - * ------ ---- ----------- - * PUC-Minas 2009-08-20 First Issue - * PUC-Minas 2009-10-20 Revised - * PUC-Minas 2016-07-30 Revised - * Kay Gürtzig 2016-09-04 Menu.menuPreferencesLanguage... key structure modified - * Kay Gürtzig 2016-09-13 Entries for InputBox and InputBoxFor revised (bugfix #241) - * Kay Gürtzig 2016-09-22 AnalyserPreferences numbering modified - * Kay Gürtzig 2016-10-11 Enh. 267: Menu.error15 renamed into Menu.error15_1 - * Kay Gürtzig 2016-12-14 Enh. #311: New menu "Debug" - * Kay Gürtzig 2017-04-05 Additions for enh. #388 and #390 (constant definition checks) - * Kay Gürtzig 2018-07-02 KGU#245: all Colors stuff replaced with array keys - * Kay Gürtzig 2018-12-30 Enh. #492: Element name place holders introduced - * Kay Gürtzig 2022-08-10 Enh. #56, #492: Messages / tooltips for TRY elements added - * Kay Gürtzig 2023-08-01 Enh. #1082: Function name included in messages Menu.error13_* - * Kay Gürtzig 2023-10-06 Issue #311: Menu reorganisation (menuDiagram split) - * Kay Gürtzig 2023-10-13 Issue #980: New messages for declaration syntax check (error31_*) - * Theldo Cruz Franqueira 2023-12-31 Completion and correction of the message set * + * Author Date Description + * ------ ---- ----------- + * PUC-Minas 2009-08-20 First Issue + * PUC-Minas 2009-10-20 Revised + * PUC-Minas 2016-07-30 Revised + * Kay Gürtzig 2016-09-04 Menu.menuPreferencesLanguage... key structure modified + * Kay Gürtzig 2016-09-13 Entries for InputBox and InputBoxFor revised (bugfix #241) + * Kay Gürtzig 2016-09-22 AnalyserPreferences numbering modified + * Kay Gürtzig 2016-10-11 Enh. 267: Menu.error15 renamed into Menu.error15_1 + * Kay Gürtzig 2016-12-14 Enh. #311: New menu "Debug" + * Kay Gürtzig 2017-04-05 Additions for enh. #388 and #390 (constant definition checks) + * Kay Gürtzig 2018-07-02 KGU#245: all Colors stuff replaced with array keys + * Kay Gürtzig 2018-12-30 Enh. #492: Element name place holders introduced + * Kay Gürtzig 2022-08-10 Enh. #56, #492: Messages / tooltips for TRY elements added + * Kay Gürtzig 2023-08-01 Enh. #1082: Function name included in messages Menu.error13_* + * Kay Gürtzig 2023-10-06 Issue #311: Menu reorganisation (menuDiagram split) + * Kay Gürtzig 2023-10-13 Issue #980: New messages for declaration syntax check (error31_*) + * PUC-Minas 2023-12-31 Completion and correction of the message set + * Kay Gürtzig 2024-02-28 Control.lblCallLevel.text message shortened + * ****************************************************************************************************** * * Comment: @@ -1444,7 +1446,7 @@ ArrangerIndex.msgConfirmDissolve.text=Quer mesmo dissolver este(s) grupo(s)?\n% Control.title=Controle do Executor Control.lblSpeed.text=Atraso: Control.btnCallStack.text=Pilha de chamadas -Control.lblCallLevel.text=Profundidade da chamada: +Control.lblCallLevel.text=Profundidade: Control.chkCollectRuntimeData.text=Coletar dados de tempo de execução Control.cbRunDataDisplay.item.0=sem cor Control.cbRunDataDisplay.item.1=cobertura de teste simples From cca9fe2116d7972a519798353d5699f9a0ff6eea Mon Sep 17 00:00:00 2001 From: codemanyak Date: Wed, 28 Feb 2024 17:48:19 +0100 Subject: [PATCH 02/12] Adjustment of delay label on Control dialog for several locales. --- src/lu/fisch/structorizer/locales/de.txt | 2 +- src/lu/fisch/structorizer/locales/es.txt | 2 +- src/lu/fisch/structorizer/locales/fr.txt | 2 +- src/lu/fisch/structorizer/locales/it.txt | 2 +- src/lu/fisch/structorizer/locales/nl.txt | 2 +- src/lu/fisch/structorizer/locales/pt_br.txt | 6 +++--- src/lu/fisch/structorizer/locales/ru.txt | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lu/fisch/structorizer/locales/de.txt b/src/lu/fisch/structorizer/locales/de.txt index d3fa8065..55deafac 100644 --- a/src/lu/fisch/structorizer/locales/de.txt +++ b/src/lu/fisch/structorizer/locales/de.txt @@ -1519,7 +1519,7 @@ ArrangerIndex.msgConfirmDissolve.text=Sicher, diese Gruppe(n) aufzulösen?\n% -----> Executor -----[ Control ]----- Control.title=Diagramm-Test -Control.lblSpeed.text=Verzögerung: +Control.lblSpeed.text= Verzögerung: Control.btnCallStack.text=Aufrufstapel Control.lblCallLevel.text=Aufruftiefe: Control.chkCollectRuntimeData.text=Sammle Laufzeitdaten diff --git a/src/lu/fisch/structorizer/locales/es.txt b/src/lu/fisch/structorizer/locales/es.txt index 329c4fd6..c5f502b8 100644 --- a/src/lu/fisch/structorizer/locales/es.txt +++ b/src/lu/fisch/structorizer/locales/es.txt @@ -1521,7 +1521,7 @@ ArrangerIndex.msgConfirmDissolve.text=Cierto a descomponer este grupo/estos grup -----> Executor -----[ Control ]----- Control.title=Control de Ejecución -Control.lblSpeed.text=Demora: +Control.lblSpeed.text= Demora: Control.btnCallStack.text=Lote de llamadas Control.lblCallLevel.text=Nivel: Control.chkCollectRuntimeData.text=Contar pasos de ejec. diff --git a/src/lu/fisch/structorizer/locales/fr.txt b/src/lu/fisch/structorizer/locales/fr.txt index e27529f4..c3fce50e 100644 --- a/src/lu/fisch/structorizer/locales/fr.txt +++ b/src/lu/fisch/structorizer/locales/fr.txt @@ -1438,7 +1438,7 @@ ArrangerIndex.msgConfirmDissolve.text=Êtes-vous sûr de dissoudre ce(s) groupe( -----> Executor -----[ Control ]----- Control.title= -Control.lblSpeed.text= +Control.lblSpeed.text= Décélération: Control.btnCallStack.text= Control.lblCallLevel.text= Control.chkCollectRuntimeData.text= diff --git a/src/lu/fisch/structorizer/locales/it.txt b/src/lu/fisch/structorizer/locales/it.txt index 48bddf51..c2706cd2 100644 --- a/src/lu/fisch/structorizer/locales/it.txt +++ b/src/lu/fisch/structorizer/locales/it.txt @@ -1416,7 +1416,7 @@ ArrangerIndex.msgConfirmDissolve.text= -----> Executor -----[ Control ]----- Control.title=Controllo Esecuzione -Control.lblSpeed.text=Ritardo: +Control.lblSpeed.text= Ritardo: Control.btnCallStack.text= Control.lblCallLevel.text= Control.chkCollectRuntimeData.text=Registra dati di esecuzione diff --git a/src/lu/fisch/structorizer/locales/nl.txt b/src/lu/fisch/structorizer/locales/nl.txt index d34b0247..94aac5dd 100644 --- a/src/lu/fisch/structorizer/locales/nl.txt +++ b/src/lu/fisch/structorizer/locales/nl.txt @@ -1389,7 +1389,7 @@ ArrangerIndex.msgConfirmDissolve.text=Wilt u echt deze groepen ontbinden?\n% -----> Executor -----[ Control ]----- Control.title=Besturing van uitvoereen -Control.lblSpeed.text=Vertraging: +Control.lblSpeed.text= Vertraging: Control.btnCallStack.text=Stack oproepen Control.lblCallLevel.text=Oproepdiepte: Control.chkCollectRuntimeData.text=Runtime-gegevens verzamelen diff --git a/src/lu/fisch/structorizer/locales/pt_br.txt b/src/lu/fisch/structorizer/locales/pt_br.txt index 591bb657..4ef417a2 100644 --- a/src/lu/fisch/structorizer/locales/pt_br.txt +++ b/src/lu/fisch/structorizer/locales/pt_br.txt @@ -64,7 +64,7 @@ * Kay Gürtzig 2023-10-06 Issue #311: Menu reorganisation (menuDiagram split) * Kay Gürtzig 2023-10-13 Issue #980: New messages for declaration syntax check (error31_*) * PUC-Minas 2023-12-31 Completion and correction of the message set - * Kay Gürtzig 2024-02-28 Control.lblCallLevel.text message shortened + * Kay Gürtzig 2024-02-28 Control.lblCallLevel.text and Control.chkCollectRuntimeData.text shortened * ****************************************************************************************************** * @@ -1444,10 +1444,10 @@ ArrangerIndex.msgConfirmDissolve.text=Quer mesmo dissolver este(s) grupo(s)?\n% -----> Executor -----[ Control ]----- Control.title=Controle do Executor -Control.lblSpeed.text=Atraso: +Control.lblSpeed.text= Atraso: Control.btnCallStack.text=Pilha de chamadas Control.lblCallLevel.text=Profundidade: -Control.chkCollectRuntimeData.text=Coletar dados de tempo de execução +Control.chkCollectRuntimeData.text=Coletar dados de execução Control.cbRunDataDisplay.item.0=sem cor Control.cbRunDataDisplay.item.1=cobertura de teste simples Control.cbRunDataDisplay.item.2=cobertura de testes profunda diff --git a/src/lu/fisch/structorizer/locales/ru.txt b/src/lu/fisch/structorizer/locales/ru.txt index 2a2536e4..06f64503 100644 --- a/src/lu/fisch/structorizer/locales/ru.txt +++ b/src/lu/fisch/structorizer/locales/ru.txt @@ -1339,7 +1339,7 @@ ArrangerIndex.msgNewGroupName.text= -----> Executor -----[ Control ]----- Control.title=Управление выполнения -Control.lblSpeed.text=Замедление +Control.lblSpeed.text= Замедление: Control.btnCallStack.text=Вывозный стек Control.lblCallLevel.text=Глубина стека: Control.chkCollectRuntimeData.text=Счесть выполнения From 60de7e687f94587ea296ddacca32b35c698f8553 Mon Sep 17 00:00:00 2001 From: codemanyak Date: Mon, 4 Mar 2024 16:52:34 +0100 Subject: [PATCH 03/12] Some message and mnemonics changes in pt_br, de, en, es --- src/lu/fisch/structorizer/gui/parsers.xml | 2 +- src/lu/fisch/structorizer/locales/de.txt | 5 ++- src/lu/fisch/structorizer/locales/en.txt | 2 ++ src/lu/fisch/structorizer/locales/es.txt | 17 +++++---- src/lu/fisch/structorizer/locales/pt_br.txt | 39 +++++++++++---------- 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/src/lu/fisch/structorizer/gui/parsers.xml b/src/lu/fisch/structorizer/gui/parsers.xml index aca3e355..ddd59946 100644 --- a/src/lu/fisch/structorizer/gui/parsers.xml +++ b/src/lu/fisch/structorizer/gui/parsers.xml @@ -22,7 +22,7 @@ - diff --git a/src/lu/fisch/structorizer/locales/de.txt b/src/lu/fisch/structorizer/locales/de.txt index 7f291f83..bfb4c194 100644 --- a/src/lu/fisch/structorizer/locales/de.txt +++ b/src/lu/fisch/structorizer/locales/de.txt @@ -143,6 +143,7 @@ * Kay Gürtzig 2023-10-13 Issues #980,#1096: New messages for declaration syntax check (error31_*) * Kay Gürtzig 2023-11-13 Enh. #1115: New messages for C99 import option definesToConstants * Kay Gürtzig 2024-03-04 Mnemonic changed on Find&Replace, PluginOptionDialog message added + * Kay Gürtzig 2024-03-09 Issue #1117: Messages for new PuginOptionDialog option dissect_anon_inner_class * ****************************************************************************************************** * @@ -1207,6 +1208,8 @@ PluginOptionDialog.btnOk.text=OK PluginOptionDialog.btnCancel.text=Abbrechen PluginOptionDialog.optionComponents.convert_syntax.text=Deklarationen/Ausdrücke usw. in Pascal-ähnlichen Stil wandeln PluginOptionDialog.optionComponents.convert_syntax.tooltip=Diese Einstellung vergrößert die Chancen der Ausführbarkeit oder des Re-Exports in Structorizer +PluginOptionDialog.optionComponents.dissect_anon_inner_class.text=Anonyme innere Klassen in Diagramme zerlegen +PluginOptionDialog.optionComponents.dissect_anon_inner_class.tooltip=Anderenfalls würde die en passant definierte innere Klasse einfach als sehr langer Quellcode-Ausdruck in das instanziierende Element durchgereicht. PluginOptionDialog.optionComponents.debugLines.text[getPluginKey():COBOLParser]=Debug-Zeilen als aktiven Code importieren PluginOptionDialog.optionComponents.debugLines.tooltip[getPluginKey():COBOLParser]=Falls aktiviert, werden Debug-Zeilen ggf. als gültiger Code importiert, anderenfalls in Kommentarzeilen "DEBUG ..." umgewandelt. PluginOptionDialog.optionComponents.decimalComma.text[getPluginKey():COBOLParser]=Dezimalkomma (statt Dezimalpunkt) im Quelltext diff --git a/src/lu/fisch/structorizer/locales/en.txt b/src/lu/fisch/structorizer/locales/en.txt index e16be7bb..eb511ca5 100644 --- a/src/lu/fisch/structorizer/locales/en.txt +++ b/src/lu/fisch/structorizer/locales/en.txt @@ -135,7 +135,8 @@ * Kay Gürtzig 2022-09-29 Bugfix #1072: New message InputBoxFor.msgIllegalWordInField added * Kay Gürtzig 2023-08-01 Enh. #1082: Function name now included in messages Menu.error13_* * Kay Gürtzig 2023-10-06 Issue #311: Menu reorganisation (menuDiagram split) - * Kay Gürtzig 2023-10-16 Issue #980/#1096: New messages for declaration syntax check (error31_*) + * Kay Gürtzig 2023-10-16 Issue #980/#1096: New messages for declaration syntax check (error31_*) + * Kay Gürtzig 2024-03-09 Issue #1117: Messages for new PuginOptionDialog option dissect_anon_inner_class * ****************************************************************************************************** * @@ -1202,6 +1203,8 @@ PluginOptionDialog.btnOk.text=OK PluginOptionDialog.btnCancel.text=Cancel PluginOptionDialog.optionComponents.convert_syntax.text= PluginOptionDialog.optionComponents.convert_syntax.tooltip= +PluginOptionDialog.optionComponents.dissect_anon_inner_class.text= +PluginOptionDialog.optionComponents.dissect_anon_inner_class.tooltip= PluginOptionDialog.optionComponents.debugLines.text[getPluginKey():COBOLParser]= PluginOptionDialog.optionComponents.debugLines.tooltip[getPluginKey():COBOLParser]= PluginOptionDialog.optionComponents.decimalComma.text[getPluginKey():COBOLParser]= diff --git a/src/lu/fisch/structorizer/locales/es.txt b/src/lu/fisch/structorizer/locales/es.txt index 65faa6bd..000676dc 100644 --- a/src/lu/fisch/structorizer/locales/es.txt +++ b/src/lu/fisch/structorizer/locales/es.txt @@ -142,7 +142,8 @@ * Kay Gürtzig 2023-10-13 Issue #980: New messages for declaration syntax check (error31_*) * Kay Gürtzig 2023-11-13 Enh. #1115: New messages for C99 import option definesToConstants * Kay Gürtzig 2024-01-26 Issue #311/bugfix #1126: Menu reorganisation (menuDiagram split) - * Kay Gürtzig 2024-03-04 Menmonics for Find&Replace dialog specified. + * Kay Gürtzig 2024-03-04 Mnemonics for Find&Replace dialog specified. + * Kay Gürtzig 2024-03-09 Issue #1117: Messages for new PuginOptionDialog option dissect_anon_inner_class * ****************************************************************************************************** * @@ -1209,6 +1210,8 @@ PluginOptionDialog.btnOk.text=Aceptar PluginOptionDialog.btnCancel.text=Cancelar PluginOptionDialog.optionComponents.convert_syntax.text=Convertir declaraciones/expresiones a un estilo como Pascal PluginOptionDialog.optionComponents.convert_syntax.tooltip=Esta opción aumenta la probabilidad de poder ejecutar o re-exportar el resultado en Structorizer +PluginOptionDialog.optionComponents.dissect_anon_inner_class.text=Desglosar clases anónimas interiores a diagramas +PluginOptionDialog.optionComponents.dissect_anon_inner_class.tooltip=De otro modo, una clase anónima definida en pasada simplemente sería puesto como una larga expresión de código fuente al elemento que contiene su instanciación. PluginOptionDialog.optionComponents.debugLines.text[getPluginKey():COBOLParser]=Importar líneas debug como código válido PluginOptionDialog.optionComponents.debugLines.tooltip[getPluginKey():COBOLParser]=Si es activada, líneas debug serán importadas como código válido, de otro modo serían convertidas en comentarios "DEBUG ...". PluginOptionDialog.optionComponents.decimalComma.text[getPluginKey():COBOLParser]=Coma decimal (en lugar de punto decimal) en el código diff --git a/src/lu/fisch/structorizer/locales/pt_br.txt b/src/lu/fisch/structorizer/locales/pt_br.txt index 414c041b..32ca9bb8 100644 --- a/src/lu/fisch/structorizer/locales/pt_br.txt +++ b/src/lu/fisch/structorizer/locales/pt_br.txt @@ -1133,6 +1133,8 @@ PluginOptionDialog.btnOk.text=OK PluginOptionDialog.btnCancel.text=Cancelar PluginOptionDialog.optionComponents.convert_syntax.text=Converter declarações/expreções a um estilo como Pascal PluginOptionDialog.optionComponents.convert_syntax.tooltip=Esta opção aumenta la probabilidade de poder executar ou re-exportar o resultado em Structorizer. +PluginOptionDialog.optionComponents.dissect_anon_inner_class.text=Desmembrar clases anônimas interiores em diagramas +PluginOptionDialog.optionComponents.dissect_anon_inner_class.tooltip=Caso contrário, uma clase anônima definida de passagem simplesmente seja pousado como longa expressão de código-fonte em o elemento que contém sua instânciasão. PluginOptionDialog.optionComponents.debugLines.text[getPluginKey():COBOLParser]= PluginOptionDialog.optionComponents.debugLines.tooltip[getPluginKey():COBOLParser]= PluginOptionDialog.optionComponents.decimalComma.text[getPluginKey():COBOLParser]= @@ -1272,11 +1274,11 @@ FindAndReplace.txtComm.border=Comentário FindAndReplace.chkElementwise.text=Elemento por elemento FindAndReplace.chkElementwise.mnemonic=e FindAndReplace.btnFind.text=Procurar -FindAndReplace.btnFind.mnemonic=r +FindAndReplace.btnFind.mnemonic=a FindAndReplace.btnReplace.text=Substituir -FindAndReplace.btnReplace.mnemonic=s +FindAndReplace.btnReplace.mnemonic=u FindAndReplace.btnReplaceFind.text=Substituir/Procurar -FindAndReplace.btnReplaceFind.mnemonic=u +FindAndReplace.btnReplaceFind.mnemonic=r FindAndReplace.btnReplaceAll.text=Substituir tudo FindAndReplace.btnReplaceAll.mnemonic=d FindAndReplace.btnReplaceAll.tooltip=Substituir todas as ocorrências restantes do padrão de pesquisa na direção especificada a partir da posição atual. diff --git a/src/lu/fisch/structorizer/parsers/JavaParser.java b/src/lu/fisch/structorizer/parsers/JavaParser.java index 980dc897..5c39952e 100644 --- a/src/lu/fisch/structorizer/parsers/JavaParser.java +++ b/src/lu/fisch/structorizer/parsers/JavaParser.java @@ -59,6 +59,7 @@ * KGU#961: Array initialiser conversion in declarations improved * Kay Gürtzig 2023-11-08 Bugfix #1110 method translateContent() returned the argument instead of the result * Kay Gürtzig 2024-03-08 KGU#1117: Missing backward replacement of c_l_a_s_s in one case mended. + * Kay Gürtzig 2024-03-09 Issue #1131: Handling of anonymous inner class instantiations * ****************************************************************************************************** * @@ -836,8 +837,8 @@ private interface RuleConstants // final int PROD_PRIMARYNONEWARRAY6 = 355; // ::= final int PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN = 356; // ::= new '(' ')' final int PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN2 = 357; // ::= new '(' ')' -// final int PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN3 = 358; // ::= new '(' ')' -// final int PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN4 = 359; // ::= new '(' ')' + final int PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN3 = 358; // ::= new '(' ')' + final int PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN4 = 359; // ::= new '(' ')' // final int PROD_ARGUMENTLIST = 360; // ::= final int PROD_ARGUMENTLIST_COMMA = 361; // ::= ',' final int PROD_ARRAYCREATIONEXPRESSION_NEW = 362; // ::= new @@ -1161,7 +1162,12 @@ protected void doExtraPreparations(StringBuilder _srcCode, File _file) throws Pa /** Represents the class definitions in the hierarchical class context */ private Stack includables = null; + /** Holds the value of the Java-specific import option "convert_syntax" */ private boolean optionConvertSyntax = false; + // START KGU#1117 2024-03-09: Issue #1131 Handle anonymous inne class instantiations properly + /** Holds the value of the Java-specific import option "dissect_anon_inner_class" */ + private boolean optionDissectInnerClass = true; + // END KGU#1117 2024-03-09 /** Maps the labels of labelled statements to the respective first element of the statement */ private HashMap labels = new HashMap(); @@ -1207,6 +1213,9 @@ protected void initializeBuildNSD() throws ParserCancelled root.children.addElement(new Forever()); optionConvertSyntax = (Boolean)this.getPluginOption("convert_syntax", false); + // START KGU#1117 2024-03-09: Issue #1131 Allow to construct diagrams from anonymous classes + optionDissectInnerClass = (Boolean)this.getPluginOption("dissect_anon_inner_class", true); + // END KGU#1117 2024-03-09 // START KGU#407 2018-03-26: Enh. #420: Configure the lookup table for comment retrieval this.registerStatementRuleIds(statementIds); @@ -2318,15 +2327,20 @@ else if (exprs.count() == 1) { * the expression such that embedded implicit or explicit assignments are extracted * to an own preceding line, combined assignment operator expressions are also * decomposed, e.g. {@code += } to {@code <- + }. + * + * @param exprToken - the {@link Token} representing the top-level expression. * @param isStatement - whether the expression represents a statement * @param leftHandSide - indicates whether the expression represents an assignment - * target expression. - * @param redExpr - the top-level expression {@link Reduction}. + * target expression. + * @param optInstNameSubst - optionally a name substitution pair (in case of an + * anonymous inner class instantiation + * * @return a {@code StringList} each elements of which contain an expression, all - * but the very last one are necessarily expression statements. + * but the very last one are necessarily expression statements. * @throws ParserCancelled */ - protected StringList decomposeExpression(Token exprToken, boolean isStatement, boolean leftHandSide) throws ParserCancelled { + protected StringList decomposeExpression(Token exprToken, boolean isStatement, boolean leftHandSide) + throws ParserCancelled { // We expect redExpr to represent one of the following // // @@ -2342,7 +2356,8 @@ protected StringList decomposeExpression(Token exprToken, boolean isStatement, b StringList exprs = new StringList(); if (exprToken.getType() == SymbolType.NON_TERMINAL) { Reduction exprRed = exprToken.asReduction(); - switch (exprRed.getParent().getTableIndex()) { + int ruleIx = exprRed.getParent().getTableIndex(); + switch (ruleIx) { case RuleConstants.PROD_ASSIGNMENT: { // ::= @@ -2737,7 +2752,28 @@ else if (!optionConvertSyntax) { exprs.set(ixLast, cast + exprs.get(ixLast)); } break; - + // START KGU#1117 2024-03-09: Issue #1131: Handle anonymous inner classes + // ATTENTION: THIS CASE MUST REMAIN AT LAST POSITION BEFORE DEFAULT! + case RuleConstants.PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN3: + case RuleConstants.PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN4: + // ::= new '(' ')' + // ::= new '(' ')' + if (this.optionDissectInnerClass) { + String className = this.deriveAnonInnerClass(exprRed); + StringList result = new StringList(); + result.add("new"); + result.add(className); + if (ruleIx == RuleConstants.PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN3) { + Token argListToken = exprRed.get(3); + processArguments(argListToken, result, exprs); + } + else { + exprs.add(result.concatenate(null) + "()"); + } + break; + } + // No break; here (or an else branch with the content of default would have to be added)! + // END KGU#1117 2024-03-09 default: // START KGU#1117 2024-03-08: Some expressions slipped through without replacement //exprs.add(this.getContent_R(exprToken)); @@ -2752,10 +2788,69 @@ else if (!optionConvertSyntax) { return exprs; } + // START KGU#1117 2024-03-09: Issue #1131 Handle anonymous inner classes + /** + * Creates the diagrams defining an anonymous inner class and its methods and + * returns a name mapping from the instantiated super class to the made-up + * generic class name of the anonymous class. + * + * @param instCreaRed - the instance creation expression {@link Reduction} + * @return the made-up name for the instantiated anonymous inner class. + * @throws ParserCancelled + */ + private String deriveAnonInnerClass(Reduction instCreaRed) throws ParserCancelled { + // ::= new '(' ')' + // ::= new '(' ')' + // FIXME Try to delegate as much as possible to a submethod shared with ClassDeclaration section + String className0 = getContent_R(instCreaRed.get(1).asReduction(), ""); + String qualifier = packageStr; + Root classRoot = root; + if (!this.includables.isEmpty()) { + // (Should always be the case here) + qualifier = this.includables.peek().getQualifiedName(); + classRoot = new Root(); + classRoot.setInclude(); + classRoot.addToIncludeList(includables.peek()); + // Add temporary dummy loops in order to gather fields and method signatures + classRoot.children.addElement(new Forever()); + classRoot.children.addElement(new Forever()); + this.addRoot(classRoot); + } + includables.push(classRoot); + classRoot.setNamespace(qualifier); + String className = className0 + "_" + Integer.toHexString(classRoot.hashCode()); + classRoot.setText(className); + // FIXME: Is this necessary here? + if (this.includables.size() == 1 && packageStr != null) { + classRoot.comment.add("==== package: " + packageStr); + if (!imports.isEmpty()) { + imports.insert("==== imports:", 0); + classRoot.comment.add(imports); + } + } + classRoot.comment.insert("CLASS" + + (this.includables.size() > 1 ? " in class " + qualifier : ""), 0); + classRoot.getComment().add(("Anonymous inner class").trim()); + classRoot.comment.add("==== " + className0); + + // Now descend into the body + int ixBody = 4; + if (instCreaRed.getParent().getTableIndex() == RuleConstants.PROD_CLASSINSTANCECREATIONEXPRESSION_NEW_LPAREN_RPAREN3) { + ixBody++; + } + this.buildNSD_R(instCreaRed.get(ixBody).asReduction(), classRoot.children); + // Dissolve the field and method containers + dissolveDummyContainers(classRoot); + this.includables.pop(); + return className; + } + // END KGU#1117 2024-03-09 + // START KGU#957 2021-03-05: Issue #959 - Processing conversion function handling /** * Processes a conversion function of the "Processing" language. The JavaParser base * code won't do anything here. + * * @param exprRed - a {@code } reduction * @return a StringList containing the necessary sequence of Structorizer instructions * and expressions to achieve the same effect. From 8d2d1256db44f3ce280df3fb43ce3c0abe2cad2e Mon Sep 17 00:00:00 2001 From: codemanyak Date: Sun, 10 Mar 2024 00:14:02 +0100 Subject: [PATCH 12/12] Finally fixes #1131 --- src/lu/fisch/structorizer/gui/changelog.txt | 2 +- src/lu/fisch/structorizer/locales/pt_br.txt | 5 +++-- src/lu/fisch/structorizer/parsers/JavaParser.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lu/fisch/structorizer/gui/changelog.txt b/src/lu/fisch/structorizer/gui/changelog.txt index d99afe63..da90ac2f 100644 --- a/src/lu/fisch/structorizer/gui/changelog.txt +++ b/src/lu/fisch/structorizer/gui/changelog.txt @@ -23,7 +23,7 @@ Known issues (also see https://github.com/fesch/Structorizer.Desktop/issues): - ARM export is still experimental and relies on a specific and very restricted syntax for the element contents in order to produce meaningful results. -Current development version 3.32-17 (2024-03-09) +Current development version 3.32-17 (2024-03-10) - 01: Bugfix #987: Duplicate subroutine comment export by Pascal generator <2> - 01: Bugfix #988: Syntax error in Structorizer.bat and Arranger.bat fixed <2> - 01: Bugfix #989: Expressions in EXIT elements (e.g. return) were forgotten diff --git a/src/lu/fisch/structorizer/locales/pt_br.txt b/src/lu/fisch/structorizer/locales/pt_br.txt index 32ca9bb8..70da0bd0 100644 --- a/src/lu/fisch/structorizer/locales/pt_br.txt +++ b/src/lu/fisch/structorizer/locales/pt_br.txt @@ -66,6 +66,7 @@ * PUC-Minas 2023-12-31 Completion and correction of the message set * Kay Gürtzig 2024-02-28 Control.lblCallLevel.text and Control.chkCollectRuntimeData.text shortened * Kay Gürtzig 2024-03-04 Mnemonics adapted, some PluginOptionDialog messages added. + * PUC-Minas 2024-03-09 Issue #1131: Messages for new Java import option provided * ****************************************************************************************************** * @@ -1133,8 +1134,8 @@ PluginOptionDialog.btnOk.text=OK PluginOptionDialog.btnCancel.text=Cancelar PluginOptionDialog.optionComponents.convert_syntax.text=Converter declarações/expreções a um estilo como Pascal PluginOptionDialog.optionComponents.convert_syntax.tooltip=Esta opção aumenta la probabilidade de poder executar ou re-exportar o resultado em Structorizer. -PluginOptionDialog.optionComponents.dissect_anon_inner_class.text=Desmembrar clases anônimas interiores em diagramas -PluginOptionDialog.optionComponents.dissect_anon_inner_class.tooltip=Caso contrário, uma clase anônima definida de passagem simplesmente seja pousado como longa expressão de código-fonte em o elemento que contém sua instânciasão. +PluginOptionDialog.optionComponents.dissect_anon_inner_class.text=Discriminar classes anônimas interiores a diagramas +PluginOptionDialog.optionComponents.dissect_anon_inner_class.tooltip=De outro modo, uma classe anônima definida instantaneamente será passada como uma extensa expressão em código fonte ao elemento instanciador. PluginOptionDialog.optionComponents.debugLines.text[getPluginKey():COBOLParser]= PluginOptionDialog.optionComponents.debugLines.tooltip[getPluginKey():COBOLParser]= PluginOptionDialog.optionComponents.decimalComma.text[getPluginKey():COBOLParser]= diff --git a/src/lu/fisch/structorizer/parsers/JavaParser.java b/src/lu/fisch/structorizer/parsers/JavaParser.java index 5c39952e..b1d7bbc9 100644 --- a/src/lu/fisch/structorizer/parsers/JavaParser.java +++ b/src/lu/fisch/structorizer/parsers/JavaParser.java @@ -2831,7 +2831,7 @@ private String deriveAnonInnerClass(Reduction instCreaRed) throws ParserCancelle classRoot.comment.insert("CLASS" + (this.includables.size() > 1 ? " in class " + qualifier : ""), 0); classRoot.getComment().add(("Anonymous inner class").trim()); - classRoot.comment.add("==== " + className0); + classRoot.comment.add("==== extends or implements " + className0); // Now descend into the body int ixBody = 4;