Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error in case of CLASS DEFINITION DEFERRED #294

Closed
mraht opened this issue Apr 17, 2024 · 2 comments
Closed

[BUG] Error in case of CLASS DEFINITION DEFERRED #294

mraht opened this issue Apr 17, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mraht
Copy link

mraht commented Apr 17, 2024

If source code contains the following statement with CLASS ... DEFINITION DEFERRED like the following code snippet, an error occurs and execution of abap cleaner is being cancelled:

CLASS: 
  lcl_exits DEFINITION DEFERRED,
  lcl_application DEFINITION DEFERRED,
  lcl_event_receiver DEFINITION DEFERRED.

image

@jmgrassau jmgrassau added the bug Something isn't working label Apr 17, 2024
@jmgrassau jmgrassau self-assigned this Apr 17, 2024
@jmgrassau
Copy link
Member

Hi Marius,

thanks for reporting this – yes, this is actually an unnecessary limitation and will be fixed with the next release. Until then, you could simply change this "CLASS: ..." chain into three "CLASS ... DEFINITION DEFERRED." statements, as suggested by the error message.

But regardless of this, you can always do nasty things with chains such as:

REPORT any_report.

START-OF-SELECTION.
  WRITE 'Hello world'.
  CLASS: lcl_any DEFINITION DEFERRED,
         lcl_other DEFINITION DEFERRED,
  lcl_any DEFINITION.

PUBLIC SECTION.
ENDCLASS.

CLASS lcl_other DEFINITION.
  PUBLIC SECTION.
ENDCLASS.

The above example was pretty-printed, but you can see how even the Pretty Printer is struggling to make sense of this. ABAP cleaner won't process such a case, either, although it is syntactically correct.

Interestingly, CLASS ... DEFINITION DEFERRED doesn't end the START-OF-SELECTION event, so if you run this:

REPORT any_report.

START-OF-SELECTION.
  WRITE / 'Hello world'.
  CLASS: lcl_any DEFINITION DEFERRED,
         lcl_other DEFINITION DEFERRED.
  WRITE / 'Hello again'.

CLASS lcl_any DEFINITION.
  PUBLIC SECTION.
ENDCLASS.

CLASS lcl_other DEFINITION.
  PUBLIC SECTION.
ENDCLASS.

you will get:

Hello world
Hello again

meaning that CLASS: ... is correctly indented with 2 spaces there.

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi Marius,

thanks again for reporting this bug – this should now be fixed with version 1.16.1, which was just released!

Kind regards,
Jörg-Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants