eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
157 stars 125 forks source link

Javadoc validation does not take into account implied end tags #1858

Open laeubi opened 8 months ago

laeubi commented 8 months ago

See this from the spec:

https://html.spec.whatwg.org/multipage/parsing.html#closing-elements-that-have-implied-end-tags

https://github.com/eclipse-equinox/equinox/blob/392063733c664ef504c8c46006633df98955a463/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/StructuredTextDelimsEsc.java#L24-L34

the <p> tag is implicitly closed, but JDT does not complain but javadoc does when it sees another closing tag:

14:38:53  [ERROR] org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/StructuredTextDelimsEsc.java:33: error: unexpected end tag: </p>
14:38:53  [ERROR]  * </p>
14:38:53  [ERROR]    ^

this currently make it quite hard to spot errors like this ones:

laeubi commented 8 months ago

It also not seem to notice if a tag is not closed at all like here

https://github.com/eclipse-platform/eclipse.platform.swt/blob/39389a24f0bcd29a3322b6337d095f01b1d85c09/bundles/org.eclipse.swt/Eclipse%20SWT/win32/org/eclipse/swt/internal/BidiUtil.java#L84-L95

Javadoc complains:

14:38:53 eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java:434: warning: empty <p> tag
14:38:53   * <p>
14:38:53     ^
jukzi commented 2 weeks ago

jdt does not have complete javadoc validation. if you want to propose a PR ... welcome.

stephan-herrmann commented 2 weeks ago

jdt does not have complete javadoc validation. if you want to propose a PR ... welcome.

more specifically: jdt validates (supposedly) all that is specific to javadoc, but it does not and probably should not validate HTML (nor markdown for that matter). IMHO, that would be a good task for an additional plugin.