GPSLogger icon indicating copy to clipboard operation
GPSLogger copied to clipboard

Don't store 'this' in static field

Open tomlayg6 opened this issue 5 years ago • 1 comments

It's not a good idea to store 'this' in a static field. In this case as far as I can tell the method getInstance() is not actually used, so the static field and related code could be dropped.

tomlayg6 avatar Nov 07 '20 15:11 tomlayg6

This applies to GPSService. Unfortunately GPSApplication does the same, however its getInstance is used many times. The static field is not final, and will be overwritten by each call to onCreate. This is not thread-safe.

tomlayg6 avatar Nov 18 '20 23:11 tomlayg6