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 188304 - API review of the SourceLevelQueryImplementation2
Summary: API review of the SourceLevelQueryImplementation2
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: apireviews
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 185031
  Show dependency tree
 
Reported: 2010-07-02 07:56 UTC by Tomas Zezula
Modified: 2010-07-15 03:32 UTC (History)
1 user (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Patch file (42.52 KB, patch)
2010-07-02 07:57 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2010-07-02 07:56:24 UTC
Current SourceLevelQuery does not support listening on changes which is needed by the annotation processing support and indexing (currently the change is triggered when  a new parser is created and it finds out that old source level != new source level, but it can be late).
A new method getSourceLevel2 was added into the SourceLevelQuery which allows listening on changes.
The old method getSourceLevel uses both SPI interfaces (SourceLevelQueryImplementation and SourceLevelQueryImplementation2) to keep compatibility. The new method does the same but for the result returned by SFBQI it's not able to support the listening (the returned source level is a snapshot). This is a reason why the SLQ.Result has a method supportsChanges which allows client to find out that the Result was created by SLQI and does not support listening.
Comment 1 Tomas Zezula 2010-07-02 07:57:30 UTC
Created attachment 100560 [details]
Patch file
Comment 2 Tomas Zezula 2010-07-02 07:59:01 UTC
The patch contains only update of j2seproject.
I will update all project types which are using QuerySupport.createSLQ() and freeform project before I will integrate it.
Comment 3 Tomas Zezula 2010-07-02 10:08:16 UTC
In the patch I've forgot to deprecate SourceLevelQueryImplementation. - Fixed.
Comment 4 Jesse Glick 2010-07-02 14:30:42 UTC
[JG01] Any reason for the use of SpecificationVersion when existing code uses String for source levels?


[JG02] Consider deprecating SourceLevelQueryImplementation. At least update its Javadoc to mention SLQI2, and refer to that in Project.getLookup Javadoc rather than SLQI.
Comment 5 Tomas Zezula 2010-07-07 12:52:22 UTC
Thanks Jesse for review.
JG01: The SpecificationVersion seems safer to me, has to be a number unlike String. The String in original SLQ was a mistake from my point of view. But no problem I will make it String to keep it the same.

JG02: Already fixed, I've forgot it.
Comment 6 Tomas Zezula 2010-07-07 12:52:49 UTC
I will integrate the API tomorrow.
Comment 7 Jesse Glick 2010-07-07 14:20:07 UTC
To JG01 - yes SpecificationVersion is somewhat safer, but it is inconsistent with existing code, and anyway does not constrain possible values nearly enough. (0.5.13?) You could use an enum; javax.lang.model.SourceVersion would be ideal but it does not include RELEASE_7 unless you are actually running on JDK 7.
Comment 8 Tomas Zezula 2010-07-08 13:02:43 UTC
Fixed jet-main 05c1ac38a4a6
Comment 9 Quality Engineering 2010-07-09 03:23:05 UTC
Integrated into 'main-golden', will be available in build *201007090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/05c1ac38a4a6
User: Tomas Zezula <tzezula@netbeans.org>
Log: #188304:API review of the SourceLevelQueryImplementation2
Comment 10 Quality Engineering 2010-07-15 03:32:22 UTC
Integrated into 'main-golden', will be available in build *201007150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/6718a2a1071d
User: pjiricka@netbeans.org
Log: #188630 - adjusting to changes introduced by API change #188304.