You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replacement of TRANSLATE and CONDENSE does not work with macro placeholders #298
I encountered the following issue: when the cleaner encounters a TRANSLATE or CONDENSE statement that uses macro placeholders (e.g., "&1") as arguments, it raises an exception "java.lang.IllegalArgumentException: Supplied TokenType IDENTIFIER unexpected for Token text '&1'; using inferred TokenType OTHER_OP!" (at com.sap.adt.abapcleaner.parser.Token.createForAbap(Token.java:291)).
As the error says, the issue is that "&1" is inferred to be of TokenType OTHER_OP, and not identifier in Token:inferTypeFromAbapToken, which then leads to the exception in Token:createForAbap.
On ABAP versions older than 7.54, this error will also occur for MOVE and ADD (and possibly lots of other rules that I didn't try out), because then this else branch will be entered.
In summary, the issue will arise for any call to Token.createForAbap() where the provided text starts with "&" and the provided type is IDENTIFIER. I guess a (maybe not so pretty) solution would be coding an exception for texts starting with "&" in Token:createForAbap() [I could provide a pull request for that].
Activity
jmgrassau commentedon May 10, 2024
Hi Pascal,
nice one, thanks for reporting this and for your analysis! This will be fixed with the next release:
Kind regards,
Jörg-Michael
fix TranslateRule etc. for placeholders in macro definitions (SAP#298)
fix TranslateRule etc. for placeholders in macro definitions (#298)
jmgrassau commentedon May 13, 2024
Hi Pascal,
thanks again for reporting this issue – this should now be fixed with version 1.16.1, which was just released!
Kind regards,
Jörg-Michael