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 179459

Summary: Add ErrorsCache that should allow indexers to simply show errors/warnings in the tasklist and error badges on files/folders/projects
Product: editor Reporter: Jan Lahoda <jlahoda>
Component: Parsing & IndexingAssignee: apireviews <apireviews>
Status: RESOLVED FIXED    
Severity: normal CC: jlahoda, ppisl, rmatous, tmysik
Priority: P3 Keywords: API, API_REVIEW_FAST
Version: 6.x   
Hardware: PC   
OS: Linux   
URL: http://lahoda.info/hgwebdir.cgi/nb-patches/raw-file/tip/task-cache-parsing-api
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 179761    
Bug Blocks: 173018    

Description Jan Lahoda 2010-01-13 09:51:49 UTC
I would like to enhance the Indexing API with a cache for errors/warnings. This cache should be filled from indexers, and should show the errors/warnings automatically in the tasklist. Error badges in the projects tab should be also handled automatically by this cache.

Also requires a small enhancement in the csl.api.

Working patch is on:
http://lahoda.info/hgwebdir.cgi/nb-patches/raw-file/tip/task-cache-parsing-api

Implementation may need improvements, but the API should be ready for review. The API changes are in:
csl.api/src/org/netbeans/modules/csl/api/Error.java
parsing.api/src/org/netbeans/modules/parsing/spi/indexing/ErrorsCache.java
Comment 1 Jan Lahoda 2010-01-13 09:55:02 UTC
Adding a new class:
parsing.api/src/org/netbeans/modules/parsing/spi/indexing/ErrorsCache.java
and changing (adding subclass):
csl.api/src/org/netbeans/modules/csl/api/Error.java

Please review. Thanks.
Comment 2 Jaroslav Tulach 2010-01-13 10:43:28 UTC
Well, that was fast! Excellent.

Y01 The Convertor pattern is slightly unusual. It deserves more documentation, for example that it will be called immediately while the method is running, not anytime later (am I right?).

Y02 Except better documentation, you might simplify life of ordinary users by providing other method that would take Iterator<Error>, and define case class Error(ErrorKind,int,String).

Y03 Error.BadgeError might be just Error.Badged or Error.Badgable or something to avoid double Error occurrence

Y04 I don't see change in dependencies of csl.api to request new version of parsing.api

As an addition to our morning discussion: Changing the friends of masterfs this way is OK.
Comment 3 Jan Lahoda 2010-01-15 06:43:23 UTC
Thanks for the comments.

Y01: I improved the javadoc with a claim that the convertor is used only inside the setErrors method invocation ("The methods on the convertor are not invoked after this method finishes."). The javadoc is still somewhat concise - if there is something particular that is missing there, I will be happy to enhance it.

Y02: I think that the ordinary users should use the convertor(s) and that the API should discourage creating wrapping objects for errors. I was able to rewrite the TLIndexer, so that it does not create wrapping objects for errors (untested, and it might be needed to use wrapping objects in TLIndexer eventually).

Y03: I renamed it to Error.Badging - but if someone has a better name, I will be happy to change it.

Y04: csl.api (currently) has an impl. dep. on parsing.api.
Comment 4 Jan Lahoda 2010-01-19 08:09:11 UTC
If there are no objections, I would like to integrate tomorrow.
Comment 5 Jan Lahoda 2010-01-21 02:51:53 UTC
Thanks for the review.
http://hg.netbeans.org/jet-main/rev/96f5c992fe4c
Comment 6 Quality Engineering 2010-01-24 08:36:52 UTC
Integrated into 'main-golden', will be available in build *201001240200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/96f5c992fe4c
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #179459: introducing ErrorsCache that allows to easily implement error badging.
Comment 7 Tomas Mysik 2010-01-25 02:11:26 UTC
I know that it's a bit late - that's why I'm not reopening this bug - but couldn't we add a yellow icon for warning? Currently, warnings are just ignored.

What do you think, Honzo?