Make inner public classes static?

Hi!

 

The EMDK API have several inner classes that are passed to callbacks. For instance, com.symbol.emdk.barcode.ScanDataCollection.ScanData when scanning barcodes.

 

The problem is that this class is an inner non-static class, which means it needs a parent instance in order to be instantiated. This makes writing unit tests difficult as well risk leaking memory as it retains a referens to the containing instance. I suggest that you make all inner classes static wherever possible, at least when they are public.

 

Thanks!

 

// Erik

Anonymous (not verified)
Thanks for the feedback Erik,

Thanks for the feedback Erik, I'll raise with the EMDK team.

Out of interest, which test framework(s) are you using?  We haven't seen many questions on automated testing with our devices which I think is a bit surprising.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Erik Hellman
We write tests using JUnit

We write tests using JUnit (regular unit tests) as well as UI tests using Espresso 2. In both cases I provide a fake provider for everything in the EMDK. This allows us to test on the emulator and eliminate any dependencies on hardware. As long as the classes in the EMDK are not final and inner public classes are static we will be fine.

Another suggestion here. It is currently a bit awkward to integrate the EMDK in the Gradle scripts. Currently I'm adding them using "provided files('/path/to/emdk.jar')" in the dependency section, but it would be great if the API could be provided as a regular (i.e., non-stubbed) JAR file, preferrably published on Maven Central.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Thanks, that's great feedback

Thanks, that's great feedback.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments