// the used packages for each exported package to find out
// if it refers to an internal package.
//
for (Iterator<PackageRef> i = toBeImported.iterator(); i.hasNext();) {
PackageRef next = i.next();
Collection<PackageRef> usedByExportedPackage = this.uses.get(next);
// We had an NPE on usedByExportedPackage in GF.
// I guess this can happen with hard coded
// imports that do not match reality ...
if (usedByExportedPackage == null || usedByExportedPackage.isEmpty()) {
continue;
}
for (PackageRef privatePackage : privatePackages) {
if (usedByExportedPackage.contains(privatePackage)) {
i.remove();
break;
}
}
}
// Clean up attributes and generate result map
Packages result = new Packages();
for (Iterator<PackageRef> i = toBeImported.iterator(); i.hasNext();) {
PackageRef ep = i.next();
Attrs parameters = exports.get(ep);
String noimport = parameters == null ? null : parameters.get(NO_IMPORT_DIRECTIVE);
if (noimport != null && noimport.equalsIgnoreCase("true"))
continue;