Community
Participate
Working Groups
HEAD For bug 178071, IJavaElement#getAttachedJavadoc(IProgressMonitor) should also work when source is attached (currently always returns null). I suggest a new constant IClasspathAttribute#JAVADOC_LOCATION_PREFERRED_ATTRIBUTE_NAME. If the attribute is set to "true", then IJavaElement#getAttachedJavadoc(..) should also fetch and return Javadoc for source elements.
Jay, please investigate for M6 as this requires a new API. The javadoc of this method actually states that it always returns null for source elements. /** * <p>Returns the Javadoc as an html source if this element has an attached javadoc, * null otherwise.</p> * <p>This should be used only for binary elements. Source elements will always return null.</p> * <p>The encoding used to read the javadoc is the one defined by the content type of the * file. If none is defined, then the project's encoding of this java element is used. If the project's * encoding cannot be retrieved, then the platform encoding is used.</p> * <p>In case of the javadoc doesn't exist for this element, null is returned.</p> We need to see if existing users can be broken by changing this behavior.
(In reply to comment #1) > We need to see if existing users can be broken by changing this behavior. Are we not going to keep the same behavior for source elements? The change would only be for the binary elements whose Javadoc need to be looked up either from the attached source or Javadoc, isn't it?
Markus, I am looking at JavadocContentAccess2#getHTMLContent and it looks like this is where we look at the source attachment for Javadoc before going to javadoc location. This is the code that is used by hover, which means by the time IJavaElement#getAttachedJavadoc() is invoked, we already know that Javadoc is not available from source attachment. Could you please confirm if I am looking at the correct place?
Sorry, I didn't debug this closely enough before filing this request. Actually, IJavaElement#getAttachedJavadoc(..) already works for binary elements with source attachments, but we currently don't use it in JavadocContentAccess2#getHTMLContent(..). We can fix the original bug 178071 on the UI side (but we would still need a classpath attribute name to configure this, and that's best declared in IClasspathAttribute). Reading the UI requests again, I found that nobody actually requests using attached Javadoc for source elements at all, so we will not invest into that. The only thing we'd need from Core is IClasspathAttribute#JAVADOC_LOCATION_PREFERRED_ATTRIBUTE_NAME. However, I looked into bug 178071 and found it's too much work for a quick fix and also requires API elsewhere, so it's unlikely we will tackle this for 3.7. I'm closing this bug for now.
Verified for 3.7M6