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

Feature Request: Point out NULL-reference #324

Open
JoachimRees opened this issue Jun 19, 2024 · 1 comment
Open

Feature Request: Point out NULL-reference #324

JoachimRees opened this issue Jun 19, 2024 · 1 comment

Comments

@JoachimRees
Copy link

[ Up front: I'm not sure if ABAP Cleaner SHOULD help here,
but I think it COULD, so I'm putting this up for consideration ]

If, in my code, I call a method of a locally defined object reference,
BEFORE there was ever a WRITE/INSTANTION on the object reference,
then this surely is a mistake (it will dump if executed).

Like un-used variables, ABAP Cleaner could point this out to me.

Example:

method do_something. 
data: not_used type any. 
data: lo_log     TYPE REF TO zcl_log.
"[...some code -  NOT touching lo_log] 
 " TODO: this is a NULL-reference!! (ABAP cleaner) 
	lo_log->add_message( ).
[... some more code]
CREATE OBJECT lo_log.
	lo_log->add_message( ).. 
"[...]
endmethod.
@jmgrassau
Copy link
Member

Hi Joachim,

I completely agree: This is a bit more the domain of static code checks (i.e. the "check" ellipsis, not the "automate" ellipsis of ABAP Tools for Clean ABAP), but there is indeed an overlap – basically whenever ABAP cleaner generates a TODO comment – and since ABAP cleaner is probably run more frequently, why not help developers discover this immediately.

Meanwhile, ABAP code samples with ABAP cleaner TODO comments start to appear on the internet ;-)

Kind regards,
Jörg-Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants