/** * Invalid imports are imports that we never refer to. They can be * calculated by removing the refered packages from the imported packages. * This leaves packages that the manifest imported but that we never use. */ private void verifyInvalidImports() { Set<String> invalidImport = newSet(mimports.keySet()); invalidImport.removeAll(referred.keySet()); // TODO Added this line but not sure why it worked before ... invalidImport.removeAll(contained.keySet()); String bactivator = getHeader(Analyzer.BUNDLE_ACTIVATOR); if (bactivator != null) { int n = bactivator.lastIndexOf('.'); if (n > 0) { invalidImport.remove(bactivator.substring(0, n)); } } if (isPedantic() && !invalidImport.isEmpty()) warning("Importing packages that are never refered to by any class on the Bundle-Classpath" + bundleClasspath + ": " + invalidImport); }
/** * Invalid exports are exports mentioned in the manifest but not found on * the classpath. This can be calculated with: exports - contains. * * Unfortunately, we also must take duplicate names into account. These * duplicates are of course no erroneous. */ private void verifyInvalidExports() { Set<String> invalidExport = newSet(mexports.keySet()); invalidExport.removeAll(contained.keySet()); // We might have duplicate names that are marked for it. These // should not be counted. Should we test them against the contained // set? Hmm. If someone wants to hang himself by using duplicates than // I guess he can go ahead ... This is not a recommended practice for (Iterator<String> i = invalidExport.iterator(); i.hasNext();) { String pack = i.next(); if (isDuplicate(pack)) i.remove(); } if (!invalidExport.isEmpty()) error("Exporting packages that are not on the Bundle-Classpath" + bundleClasspath + ": " + invalidExport); }
/** * Invalid exports are exports mentioned in the manifest but not found on * the classpath. This can be calculated with: exports - contains. * * Unfortunately, we also must take duplicate names into account. These * duplicates are of course no erroneous. */ private void verifyInvalidExports() { Set<String> invalidExport = newSet(mexports.keySet()); invalidExport.removeAll(contained.keySet()); // We might have duplicate names that are marked for it. These // should not be counted. Should we test them against the contained // set? Hmm. If someone wants to hang himself by using duplicates than // I guess he can go ahead ... This is not a recommended practice for (Iterator<String> i = invalidExport.iterator(); i.hasNext();) { String pack = i.next(); if (isDuplicate(pack)) i.remove(); } if (!invalidExport.isEmpty()) error("Exporting packages that are not on the Bundle-Classpath" + bundleClasspath + ": " + invalidExport); }
/** * Invalid imports are imports that we never refer to. They can be * calculated by removing the refered packages from the imported packages. * This leaves packages that the manifest imported but that we never use. */ private void verifyInvalidImports() { Set<String> invalidImport = newSet(mimports.keySet()); invalidImport.removeAll(referred.keySet()); // TODO Added this line but not sure why it worked before ... invalidImport.removeAll(contained.keySet()); String bactivator = getHeader(Analyzer.BUNDLE_ACTIVATOR); if (bactivator != null) { int n = bactivator.lastIndexOf('.'); if (n > 0) { invalidImport.remove(bactivator.substring(0, n)); } } if (isPedantic() && !invalidImport.isEmpty()) warning("Importing packages that are never refered to by any class on the Bundle-Classpath" + bundleClasspath + ": " + invalidImport); }