code: protected Package[] getPackages() {
          Map<String, Package> map;
          synchronized (packages) {
              map = new HashMap<>(packages);
          }
          return map.values().toArray(new Package[map.size()]);
      }
docs: Returns all of the <tt>Packages</tt> defined by this class loader and
  its ancestors.
  
  @return  The array of <tt>Package</tt> objects defined by this
  <tt>ClassLoader</tt>
  
  @since  1.2