Skip to content

bug: Spoon's "getShortDescription" and "getLongDescription" handling is too primitive #4059

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

Closed
I-Al-Istannen opened this issue Jul 21, 2021 · 1 comment · Fixed by #4061
Closed
Labels

Comments

@I-Al-Istannen
Copy link
Collaborator

Context

Spoon offers a getShortDescription() method in CtJavadoc. This method should (I guess) return the short Javadoc the standard HTML Doclet displays in the method table. The javadoc tool description (e.g. here) says:

Copies the first sentence of the overview comment to the top of the overview summary page.

Problem statement

Sadly the current handling is a bit too simplistic (I heard an issue is only complete once it includes images, so here goes nothing):
grafik
grafik

As you can see the javadoc is cut off after java.. Spoon sees the Javadoc:

/**
 * An extended version of <code>java.awt.Frame</code> that adds support for
 * the JFC/Swing component architecture.

and the Javadoc

/**
 * Accepts a function that extracts a {@link java.lang.Comparable
 * Comparable} sort key from a type {@code T}, and returns a {@code
 * Comparator<T>} that compares by that sort key.

and assumes the span until the first dot is the summary. Sadly, this doesn't work with links - which are quite common.

Solutions

We could try a bit harder and not just scan for the first . but instead look for the first . followed by a space or a newline. This should at least improve the heuristic by quite a bit.

@andrewbwogi
Copy link
Contributor

Your solution seems reasonable. I'll see if we can implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants