3 Replies Latest reply on Feb 23, 2017 5:20 AM by Darryn Campbell

    Make inner public classes static?

    Erik Hellman

      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