diff options
-rw-r--r-- | org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java | 20 | ||||
-rw-r--r-- | org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java | 6 |
2 files changed, 24 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java index f095b8f82b..0938c2f4ce 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java @@ -610,7 +610,7 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable { IProject getProject(); /** - * Returns the <code>IModuleDescription</code> this project represents or + * Returns the {@link IModuleDescription} this project represents or * null if the Java project doesn't represent any named module. A Java * project is said to represent a module if any of its source package * fragment roots (see {@link IPackageFragmentRoot#K_SOURCE}) contains a @@ -620,7 +620,7 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable { * In the latter case the corresponding module description of the * location referenced by that classpath entry is returned. * - * @return the <code>IModule</code> this project represents. + * @return the {@link IModuleDescription} this project represents. * @exception JavaModelException if this element does not exist or if an * exception occurs while accessing its corresponding resource * @since 3.14 @@ -628,6 +628,22 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable { IModuleDescription getModuleDescription() throws JavaModelException; /** + * Returns the <code>IModuleDescription</code> owned by this project or + * null if the Java project doesn't own a valid Java module descriptor. + * This method considers only module descriptions contained in any of the + * project's source package fragment roots (see {@link IPackageFragmentRoot#K_SOURCE}). + * In particular any {@link IClasspathAttribute#PATCH_MODULE} attribute + * is not considered. + * + * @return the {@link IModuleDescription} this project owns. + * @exception JavaModelException if this element does not exist or if an + * exception occurs while accessing its corresponding resource + * @throws JavaModelException + * @since 3.20 + */ + IModuleDescription getOwnModuleDescription() throws JavaModelException; + + /** * Returns the raw classpath for the project, as a list of classpath * entries. This corresponds to the exact set of entries which were assigned * using <code>setRawClasspath</code>, in particular such a classpath may diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java index e2cf1bfbc6..d91f25149a 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java @@ -3831,6 +3831,12 @@ public class JavaProject return null; } + @Override + public IModuleDescription getOwnModuleDescription() throws JavaModelException { + JavaProjectElementInfo info = (JavaProjectElementInfo) getElementInfo(); + return info.getModule(); + } + public List<String> getPatchedModules(IClasspathEntry cpEntry) { String patchModules = ClasspathEntry.getExtraAttribute(cpEntry, IClasspathAttribute.PATCH_MODULE); if (patchModules != null) { |