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);

            // Even though we haven't recompiled this package, we may have
            // information about its public API: It may be a classpath dependency
            if (packages.containsKey(pkg)) {
                pprev.setPubapi(PubApi.mergeTypes(pprev.getPubApi(),
                                                  packages.get(pkg).getPubApi()));
            }

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