This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 251178 - @SupportedAnnotationTypes annotation doesn't quote selected path
Summary: @SupportedAnnotationTypes annotation doesn't quote selected path
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.2
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-14 14:38 UTC by brettryan
Modified: 2015-09-30 03:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description brettryan 2015-03-14 14:38:54 UTC
I just discovered a cool feature that the @SupportedAnnotationTypes annotation offers code completion, however the completion does not quote the class when selected as required by @SupportedAnnotationTypes.

Steps to reproduce:

1. Add @SupportedAnnotationTypes(
2. Press CTRL+SPACE
3. Type `com'
4. Type a period `.'
5. Select one of the annotations from list of results.

Expected Behaviour:

- List of found annotations on project classpath should be shown at step (2)
- Typing period `.' at step (4) should narrow results.
- Selected annotation at step (5) should be returned within a quoted string.

Actual Behaviour:

- Steps 1-3 behave correctly but typing the further period incorrectly selects the first annotation starting with com.
- Step (5) incorrectly enters the text of the desired annotation selected but does not quote the string which is required by @SupportedAnnotationTypes.

Suggested Improvement:

- Allow the code completion to be activated even when the quotes are present, this will allow for modifying an existing value.
- Allow navigating by CTRL+Click(ing) the class name.
Comment 1 Dusan Balek 2015-04-02 16:12:45 UTC
Partially fixed in jet-main. Selected annotation is returned within a quoted string and code completion can be activated even when the quotes are present.
Typing dot still inserts the selected completion item, since dot is one of the default completion selector characters. However, this can be changed by removing dot from the completion selectors via Tools->Options->Editor->Code Completion->Java

http://hg.netbeans.org/jet-main/rev/f5102d1ec8d8
Comment 2 Quality Engineering 2015-04-03 03:07:51 UTC
Integrated into 'main-silver', will be available in build *201504030001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f5102d1ec8d8
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #251178: @SupportedAnnotationTypes annotation doesn't quote selected path - fixed.
Comment 3 brettryan 2015-09-30 03:12:02 UTC
Thanks for the fix, much appreciated.

I might point out that removing the dot from a completion activator would become inconsistent with using other unquoted cases.

Consider with the import statement.

I can type

import j

then activate code completion (ctrl+space) and further type the following:

import j.u.L;

which would insert at each period respectively:

import java.
import java.util.
import java.util.List;

When using with @SupportedAnnotationTypes I might type:

@SupportedAnnotationTypes("

Activate completion (ctrl+space) then type

@SupportedAnnotationTypes("java.

instead of just inserting java and continuing completion to get the next package it will insert

@SupportedAnnotationTypes("java.beans.ConstructorProperties".

This isn't consistent with the import statement completion, thus; I wouldn't recommend turning it off as it regresses other functionality.

I can however understand that because it's a string being inserted as to why the problem occurs.