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

CLASS ... DEFINITION DEFERRED not working #142

Closed
ruhnla opened this issue Oct 11, 2023 · 7 comments
Closed

CLASS ... DEFINITION DEFERRED not working #142

ruhnla opened this issue Oct 11, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@ruhnla
Copy link

ruhnla commented Oct 11, 2023

The ABAP cleaner stops immediately when the command CLASS ... DEFINITION DEFERRED is found with the error message "Opening 'CLASS' not closed." (ABAP version 7.50)

image

Is this a bug or a feature or missing functionality?

@jmgrassau
Copy link
Member

Hi ruhnla,

that's odd, actually ABAP cleaner does consider CLASS ... DEFINITION DEFERRED and does not expect an ENDCLASS here. Could you maybe try to create a minimal example for this (removing everything that doesn't trigger the error)? Do you use the plug-in or the stand-alone ABAP cleaner, and which version of it?

Kind regards,
Jörg-Michael

@ruhnla
Copy link
Author

ruhnla commented Oct 12, 2023

Hi Jörg-Michael,

I have tried both versions of ABAP cleaner, ADT and standalone, latest version (1.71). In the standalone version I can't even paste the code.

Here you have a simple example of coding where it happens.

`

  •   Class definition for ALV toolbar
    

CLASS: lcl_alv_toolbar DEFINITION DEFERRED.

DATA : c_alv_toolbarmanager TYPE REF TO cl_alv_grid_toolbar_manager,
c_alv_toolbar TYPE REF TO lcl_alv_toolbar.

  •   CLASS lcl_alv_toolbar DEFINITION
    

CLASS lcl_alv_toolbar DEFINITION.
PUBLIC SECTION.

  •   Constructor
    
    METHODS: constructor IMPORTING io_alv_grid TYPE REF TO cl_gui_alv_grid.

ENDCLASS. "lcl_alv_toolbar DEFINITION

  •   CLASS lcl_alv_toolbar IMPLEMENTATION
    

CLASS lcl_alv_toolbar IMPLEMENTATION.

METHOD constructor.

  •   Create ALV toolbar manager instance
    
    CREATE OBJECT c_alv_toolbarmanager
    EXPORTING
    io_alv_grid = io_alv_grid.
    ENDMETHOD. "constructor

ENDCLASS. "lcl_alv_toolbar IMPLEMENTATION
`

Best,
Lars

@jmgrassau
Copy link
Member

Hi Lars,

I see – it's the colon! I didn't expect CLASS to be followed by :, so if you remove that, things will work (and I shall enhance the code to consider this case, too).

Kind regards,
Jörg-Michael

@jmgrassau jmgrassau self-assigned this Oct 12, 2023
@jmgrassau jmgrassau added the bug Something isn't working label Oct 12, 2023
@jmgrassau
Copy link
Member

Hi Lars,

okay, that wasn't difficult, this will be considered in the next release.

Kind regards,
Jörg-Michael

@ConjuringCoffee
Copy link
Contributor

: seems to be one of the greatest threats to the ABAP Cleaner 😄

@jmgrassau
Copy link
Member

Hi ConjuringCoffee,

yes, along with comments and pragmas that's indeed the case! From this perspective, life is rather easy for a compiler, which can do a pre-processing step and

  • throw away any whitespace for good,
  • remove all comments,
  • expand all chains,
  • apply all macros,

and only then start doing its actual job (well, admittedly, there might be some complexity in that part…).

But not for ABAP cleaner! Because we care a lot about whitespace and alignment, have to stay aware that there may be any number of comments anywhere (including between any two tokens inside of a statement), must mind the pragmas (including in wrong places) and the chain colons …

So, unfortunately, so far, there was always a constellation that wasn't yet considered. But let's hope the new "stress test" which I mentioned in #147 helps to identify more of those in advance! :-)

And anyway, diligently writing regression tests, so at least we can be sure that whatever issue came up once for someone won't come up again for anyone! 🙂

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi Lars,

thanks again for reporting this – this issue should now be fixed in version 1.7.2, 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

3 participants