Bug 552196 - Project with --patch-module in .classpath cannot be run due
to "SUT specified more than once to --patch-module"

- polish

Change-Id: I952e58f8a67d03cb1837f4e193257f08c6601751
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
index ea2b1cf..35078b3 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
@@ -68,7 +68,6 @@
 import org.eclipse.jdt.core.IClasspathAttribute;
 import org.eclipse.jdt.core.IClasspathContainer;
 import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.IJavaModel;
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.IModuleDescription;
@@ -1396,7 +1395,7 @@
 				}
 			}
 		}
-		boolean isModular = project.getModuleDescription() != null && !isPatching(project);
+		boolean isModular = project.getOwnModuleDescription() != null;
 		if (nonDefault.isEmpty() && !isModular && !excludeTestCode) {
 			// return here only if non-modular, because patch-module might be needed otherwise
 			return null;
@@ -1422,20 +1421,6 @@
 		return locations;
 	}
 
-	private static boolean isPatching(IJavaProject project) throws JavaModelException {
-		IModuleDescription module = project.getModuleDescription();
-		if (module == null) {
-			return false;
-		}
-		IJavaElement ancestor = module.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
-		if (ancestor != null) {
-			if (((IPackageFragmentRoot) ancestor).isArchive() || !project.equals(ancestor.getJavaProject())) {
-				return true;
-			}
-		}
-		return false;
-	}
-
 	private static boolean containsModuleInfo(IRuntimeClasspathEntry entry) {
 		return new File(entry.getLocation() + File.separator + "module-info.class").exists(); //$NON-NLS-1$
 	}