Bug 537549 - Clean up some warnings, use isQualified instead of targets

Change-Id: Icfe95c03d677df9c929da98b17cc853d432a8b39
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
index c541e6c..7019531 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
@@ -1704,6 +1704,7 @@
 		return result.toString();
 	}
 
+	@SuppressWarnings("unchecked")
 	private String calculateVMPackages() {
 		try {
 			List<String> packages = new ArrayList<>();
@@ -1714,10 +1715,10 @@
 			Method getDescriptor = moduleClass.getMethod("getDescriptor"); //$NON-NLS-1$
 			Class<?> moduleDescriptorClass = Class.forName("java.lang.module.ModuleDescriptor"); //$NON-NLS-1$
 			Method exports = moduleDescriptorClass.getMethod("exports"); //$NON-NLS-1$
-			Method isAutomatic = moduleDescriptorClass.getMethod("isAutomatic");
-			Method packagesMethod = moduleDescriptorClass.getMethod("packages");
+			Method isAutomatic = moduleDescriptorClass.getMethod("isAutomatic"); //$NON-NLS-1$
+			Method packagesMethod = moduleDescriptorClass.getMethod("packages"); //$NON-NLS-1$
 			Class<?> exportsClass = Class.forName("java.lang.module.ModuleDescriptor$Exports"); //$NON-NLS-1$
-			Method targets = exportsClass.getMethod("targets"); //$NON-NLS-1$
+			Method isQualified = exportsClass.getMethod("isQualified"); //$NON-NLS-1$
 			Method source = exportsClass.getMethod("source"); //$NON-NLS-1$
 
 			Object bootLayer = boot.invoke(null);
@@ -1735,7 +1736,7 @@
 				} else {
 					for (Object export : (Set<?>) exports.invoke(descriptor)) {
 						String pkg = (String) source.invoke(export);
-						if (((Set<?>) targets.invoke(export)).isEmpty()) {
+						if (!((Boolean) isQualified.invoke(export))) {
 							packages.add(pkg);
 						}
 					}