-
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
8285150: Improve tab completion for annotations #22840
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
} | ||
if (tp.getParentPath().getLeaf().getKind() == Kind.NEW_ARRAY && | ||
((NewArrayTree) tp.getParentPath().getLeaf()).getInitializers().contains(tp.getLeaf())) { | ||
return isAnnotationAttributeValue(tp.getParentPath()); |
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 recall JLS requires annotation arrays to be one-dimensional only, but this check seems to allow multi-dimensional arrays with annotation elements.
@@ -949,6 +1024,17 @@ private Predicate<Element> createAccessibilityFilter(AnalyzeTask at, TreePath tp | |||
}; | |||
} | |||
|
|||
private boolean isAnnotationAttributeValueType(AnalyzeTask at, TypeMirror type) { |
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.
This name is misleading - it is checking if a static final field type is suitable for an annotation attribute. This is more restrictive than general annotation element return types, which also allows annotation interfaces and one-dimensional arrays of primitives, enums, strings, and annotation interfaces.
When using types code like:
and presses
<tab>
, there should be a sensible completion, but currently there is nothing. This PR proposes to add code completion for annotation attributes.Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22840/head:pull/22840
$ git checkout pull/22840
Update a local copy of the PR:
$ git checkout pull/22840
$ git pull https://git.openjdk.org/jdk.git pull/22840/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22840
View PR using the GUI difftool:
$ git pr show -t 22840
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22840.diff
Using Webrev
Link to Webrev Comment