-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8242564: javadoc crashes:: class cast exception com.sun.tools.javac.code.Symtab$6 #17435
Conversation
👋 Welcome back vpetko! A progress list of the required criteria for merging this PR into |
test ran at commit 53d2985 fail due to the ClassCastException:
Test ran at the commit 9ebb1ac (tip of the branch(with fix included) pass:
|
test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java
Outdated
Show resolved
Hide resolved
test/langtools/jdk/javadoc/doclet/testClassTree/badpkg/ChildClass.java
Outdated
Show resolved
Hide resolved
Webrevs
|
@jonathan-gibbons I apologise for the ping, would it be possible to take another look at this MR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on.
The work does show up more problems than it solves (!!) such as the use of JavaFileObject.Kind.OTHER
, and the inconsistent output generated by the test. But both of those are out of scope for this work, which is primarily about avoiding a crash caused by an unexpected exception.
There's a typo (exeception
) in the title that I cannot fix for you, and there are some suggestions to improve the comments and class names in the test. Do those and you'll be good to go.
checkOutput("badpkg/ChildClass.html", true, | ||
""" | ||
<div class="type-signature"><span class="modifiers">public class </span>\ | ||
<span class="element-name type-name-label">ChildClass</span> | ||
<span class="extends-implements">extends ParentClass | ||
implements java.lang.Iterable</span></div> | ||
"""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this code may check what is generated, the output seems inconsistent. In particular, ParentClass
is mentioned, but AnInterface
is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've split it into a separate issue - https://bugs.openjdk.org/browse/JDK-8324791, would it be ok for me to look into addressing it?
test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java
Outdated
Show resolved
Hide resolved
test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java
Outdated
Show resolved
Hide resolved
if (te.asType().getKind() == TypeKind.ERROR) | ||
return Kind.OTHER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a medium deep-dive, I looked at whether this was the "best" solution, or whether it was "second best" and that we should fix the origin of the ClassCastException
in Symbol.outermostclass()
. Bottom line: while we could fix it for this case, in general, there is no way to guarantee that there is a reasonable result of type ClassSymbol
for every reasonable symbol for which this method is called. Arguably, .outermostclass
could do more checking and/or throw some exception and/or return null
, but that is not the javac style, and we would still have to deal with the issue at call sites, like this one.
It's also debatable whether the correct return value is OTHER
or null
. OTHER
has typically meant some kind of file with an unknown extension and not no file. The spec is unclear on this point, and clarifying the spec is out of scope in this PR, and would require a CSR. So, for now, OTHER
is OK.
Thank you for reviewing PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing the final round of changes.
@vpa1977 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 165 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jonathan-gibbons) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
/sponsor |
Going to push as commit 64c3642.
Your commit was automatically rebased without conflicts. |
@jonathan-gibbons @vpa1977 Pushed as commit 64c3642. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
'--ignore-source-errors' allows generating Javadoc for the packages that contain compilation errors.
jdk.javadoc.internal.doclets.toolkit.util.ClassTree generates a type hierarchy for javadoc that may include error types such as
where Bar is undefined.
The user still wants to generate documentation for Foo and have Bar as a text label.
For the unknown class Bar it is impossible to detect the enclosing class/file and javadoc crashes with exception.
This PR returns Kind.OTHER for the error types, avoiding the javadoc crash.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17435/head:pull/17435
$ git checkout pull/17435
Update a local copy of the PR:
$ git checkout pull/17435
$ git pull https://git.openjdk.org/jdk.git pull/17435/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17435
View PR using the GUI difftool:
$ git pr show -t 17435
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17435.diff
Webrev
Link to Webrev Comment