-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
JDK-8312445: Array types in annotation elements show square brackets twice #15019
Conversation
👋 Welcome back hannesw! A progress list of the required criteria for merging this PR into |
Webrevs
|
@@ -36,7 +36,8 @@ | |||
a = @AnnotationType(optional="foo",required=1994), | |||
sa = {"up", "down"}, | |||
primitiveClassTest = boolean.class, | |||
arrayClassTest = String[].class, | |||
arrayPrimitiveTest = boolean[].class) | |||
arrayClassTest = String[][].class, |
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.
Update the copyright year in this file.
|
||
// XXX: Add array test case after this if fixed: | ||
//5020899: Incorrect internal representation of class-valued annotation elements |
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 deleting this effective FIXME.
public Content visitArray(ArrayType t, Void p) { | ||
// render declared base component type as link | ||
return visit(t.getComponentType()).add("[]"); | ||
} | ||
}.visit(t); | ||
@Override | ||
protected Content defaultAction(TypeMirror t, Void p) { | ||
return new TextBuilder(t.toString()); | ||
} | ||
}.visit(t).add(".class"); |
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 know that naming is hard, but consider renaming this or the outer t
so they don't name-clash. Given a parameter with the same name is also present in defaultAction
, I'd probably renamed the outer t
. Renaming one parameter is simpler than renaming two parameters.
This is how it's done by some IDE code editors whilst you hover over a class literal, which is probably okay. |
Thanks for the review @pavelrappo, feedback is addressed in a new commit. |
arrayPrimitiveTest = boolean[].class) | ||
arrayClassTest = String[][].class, | ||
arrayPrimitiveTest = boolean[].class, | ||
classArrayTest = {TypeParameterSubClass[].class, String.class, long[][][].class}) |
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.
Consider adding multi-dimensional array of TypeParameterSubClass
, to test link generation. The problem with long[][][]
is that there's nowhere to link to. The problem with String[][]
is that JDK source where the java.lang.String
doc comment resides is unavailable.
Alternatively, you could probably link to platform, so that we could see output for String[][]
.
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.
Looks good.
@hns 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 14 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. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 02a0473.
Your commit was automatically rebased without conflicts. |
Please review a change to fix the representation of array types as values of annotation elements in javadoc-generated documentation.
The primary fix is to avoid generating duplicate
[]
brackets for array types, but there are a few secondary improvements:.class
as plain text after the link.class
after the linkLinkFactory
code to decide whether to use the qualified or simple type name for a link (usesisLinkable
instead ofisIncluded
)There already was some test code for the use of array types in annotation elements in
TestNewLanguageFeatures.java
, but it was disabled with a comment referring to another issue that has long been resolved.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15019/head:pull/15019
$ git checkout pull/15019
Update a local copy of the PR:
$ git checkout pull/15019
$ git pull https://git.openjdk.org/jdk.git pull/15019/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15019
View PR using the GUI difftool:
$ git pr show -t 15019
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15019.diff
Webrev
Link to Webrev Comment