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.
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.
Created attachment 100560 [details] Patch file
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.
In the patch I've forgot to deprecate SourceLevelQueryImplementation. - Fixed.
[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.
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.
I will integrate the API tomorrow.
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.
Fixed jet-main 05c1ac38a4a6
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
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.