Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MJAVADOC-775] Option 'taglets/taglet/tagletpath' ignored when pointing to a JAR #255

Merged
merged 1 commit into from
Jul 14, 2024

Conversation

kriegaex
Copy link
Contributor

@kriegaex kriegaex commented Dec 13, 2023

Fixes MJAVADOC-775.
Fixes MJAVADOC-783.

@elharo, @robjg, @jkesselm


To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@michael-o
Copy link
Member

michael-o commented Dec 13, 2023

@kriegaex Thank you for the PR. I first need to understand the original reports and your change whether I can computer this reasonably. It will take a few days. Tell me please, is an IT required here in this case or is the UT enough?

@kriegaex
Copy link
Contributor Author

@michael-o, you can find detailed information and reproducers in the two linked Jira issues.

As for ITs, taglet paths are completely untested. At least, I did not find anything there. The string "taglet" does not occur at all in the IT directory. I think, ITs would make sense in general. But my PR does not make IT coverage any worse than zero. As for unit tests, I added a test for the new method.

As one of the issues was closed after so-called "triage" without proper investigation, just because the two sounded similar, I was concerned that this topic would not be taken seriously by the product maintainers. So, I contributed this PR, which was not my original plan. I cannot fix all issues I encounter in all OSS products by myself, always dealing with code I have never seen before, and on top of it also improve test coverage. My own projects are already suffering more than is good for them. So please, let us not blow up the scope of this PR. But by all means, feel free to add ITs, committing on top of my changes after the merge. 🙂

@michael-o
Copy link
Member

@michael-o, you can find detailed information and reproducers in the two linked Jira issues.

As for ITs, taglet paths are completely untested. At least, I did not find anything there. The string "taglet" does not occur at all in the IT directory. I think, ITs would make sense in general. But my PR does not make IT coverage any worse than zero. As for unit tests, I added a test for the new method.

As one of the issues was closed after so-called "triage" without proper investigation, just because the two sounded similar, I was concerned that this topic would not be taken seriously by the product maintainers. So, I contributed this PR, which was not my original plan. I cannot fix all issues I encounter in all OSS products by myself, always dealing with code I have never seen before, and on top of it also improve test coverage. My own projects are already suffering more than is good for them. So please, let us not blow up the scope of this PR. But by all means, feel free to add ITs, committing on top of my changes after the merge. 🙂

If you consider both JIRA issues distinct although the fix is identical, I can reopen the closed one, no problem.

@kriegaex
Copy link
Contributor Author

The fix is not identical. There are two separate commits in this PR, fixing two distinct problems. Please read the commit comments, I referenced one issue per commit. I just did not want to create two PRs, because my time is limited, and I did not want to rebase later.

@michael-o
Copy link
Member

The fix is not identical. There are two separate commits in this PR, fixing two distinct problems. Please read the commit comments, I referenced one issue per commit. I just did not want to create two PRs, because my time is limited, and I did not want to rebase later.

My bad.

@elharo elharo changed the title [MJAVADOC-775, MJAVADOC-783] Taglet path fixes [MJAVADOC-783] Taglet path fixes Dec 13, 2023
Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think we need an integration test for this, or perhaps expanded unit test coverage. Without that we don't know that taglet paths now work.

@kriegaex
Copy link
Contributor Author

I do think we need an integration test for this, or perhaps expanded unit test coverage. Without that we don't know that taglet paths now work.

You did not know before either. Like I said, feel free to write an IT. Do not abuse contributors to catch up with work that was not done when it was due for existing code.

@kriegaex
Copy link
Contributor Author

kriegaex commented Dec 13, 2023

Rewrite Javadoc to clarify

@elharo, if you did not notice by inspecting my PR: I have just contributed something valuable, fixing two bugs within 30 minutes of seeing this code for the first time in my life. It is meant to be a minimally invasive change, not a structural refactoring of either code or javadoc. Hence, I kept wording and structure of the existing javadocs intact. Otherwise, I would have had to rewrite the javadocs for the whole class and maybe also for the rest of the module.

FYI, I also checked whom you can ask what this javadoc means and why it was written that way: Vincent Siveton. I do not like style and wording either, but that was not the focus of this PR. In Vincent's defence, if you also look at the code, it becomes pretty clear what he means, even though probably you and I would have written the docs differently.

There is a software craftsmanship principle which is often forgotten: to separate refactoring from functional changes. This PR is about functional changes and not supposed to restructure the code or its documentation more than necessary to accomodate to the fact that I made one method more flexible by an additional parameter and call that method from the previously existing one in to avoid code duplication.

@kriegaex
Copy link
Contributor Author

kriegaex commented Dec 14, 2023

I do think we need an integration test for this, or perhaps expanded unit test coverage. Without that we don't know that taglet paths now work.

You did not know before either. Like I said, feel free to write an IT. Do not abuse contributors to catch up with work that was not done when it was due for existing code.

@elharo, I forgot to mention a detail: When you start writing ITs and want to keep the build running on both JDK 8 and JDK 9+ (CI builds currently run on 8 and 17), enjoy implementing all sample taglets twice, once for the old Doclet API and again for the new Doclet API on JDK 9+, see JEP 221. You can have the same fun I had when helping out a bit at Xalan-Java, creating JDK-dependent Java profiles adding a JDK 8 taglet module for the old API and a JDK 9+ one for the new API. All of this only to have sample code for ITs. Xalan-Java at least uses the doclets for their own javadocs.

Of course, it makes sense to have such ITs, I am not denying that at all. But it is way off limits for this bugfix PR. Before anyone creates such ITs, the Maven Javadoc team should maybe first decide, if the small benefit of being able to still build (not run, only build!) the plugin on JDK 8 is worth the more than duplicate (because of extra profiles and distinction of cases) effort of creating and maintaining such ITs. After that decision, work on ITs can start in a separate PR.

@michael-o michael-o changed the title [MJAVADOC-783] Taglet path fixes [MJAVADOC-775] Option 'taglets/taglet/tagletpath' ignored when pointing to a JAR Jul 14, 2024
…ng to a JAR

New method JavadocUtil::prunePaths takes care of pruning classpath elements
correctly, the existing JavadocUtil::pruneDirs is now just a special
case delegating to prunePaths.

This closes apache#255
Copy link
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good enough for me now, will merge as soon as CI passes.

Note that I have lifted the restrictions on JAR files for two reasons:

  • We don't filter with tagletpath, it should be consistent
  • ZIP files are first class classpath elements as well, so we allow everything and the rest is the responsiblity of the developer

@asfgit asfgit merged commit 91369fa into apache:master Jul 14, 2024
82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants