code: public void copyPackagesExcept(BuildState prev, Set<String> recompiled, Set<String> removed) {
          for (String pkg : prev.packages().keySet()) {
              // Do not copy recompiled or removed packages.
              if (recompiled.contains(pkg) || removed.contains(pkg)) continue;
              Module mnew = findModuleFromPackageName(pkg);
              Package pprev = prev.packages().get(pkg);
              mnew.addPackage(pprev);
              // Do not forget to update the flattened data.
              packages.put(pkg, pprev);
          }
      }
docs: During an incremental compile we need to copy the old javac state
  information about packages that were not recompiled.