eclipse-jdt / eclipse.jdt.ui

Eclipse Public License 2.0
36 stars 86 forks source link

javadoc: Explicit link to package without package-info.java does not work #1579

Open stephan-herrmann opened 1 month ago

stephan-herrmann commented 1 month ago

Found during #1472: within javadoc an explicit link to a package only works when package-info.java exists. Implicit links "work", though.

/**
 * See package {@link java.util} or {@link java.util.List}
 */
public class Javadoc {
}

The link {@link java.util} does not navigate anywhere.

Navigating first to java.util.List shows the qualified name whose segment util lets me navigate to the package (albeit signaling "Note: The Javadoc for this element could neither be found in the attached source nor the attached Javadoc.").

In https://openjdk.org/jeps/467, however, I learned that such package links should work.

caldy2000 commented 1 month ago

hello, i tried to write a comment on a method.

    /**
     * 通过反射创建新的实例。
     * 如果想通过反射创建新的实例,在jdk9之后,使用{@link Constructor#newInstance(Object...) newInstance}来创建
     * 
     * and redirect to {@link java.lang.Object}, and to {@link java.lang}
     */
    public void createNewInstance() {

    }

run command line :

 H:\dev\java\jdk11\bin\javadoc.exe -encoding utf-8 -charset utf-8 -d .\bin\javadoc\ -cp .\src -link 'https://docs.oracle.com/en/java/javase/11/docs/api/' javadoc

this is project's layout: image

open method's javadoc in browser: image

link can redirect as expected whether it's class member or package reference, but eclipse java editor can't give a hyperlink on a package reference, class member reference works.

Reference

stephan-herrmann commented 1 month ago

eclipse java editor can't give a hyperlink on a package reference, class member reference works.

exactly, that's what this issue is about.