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 251605 - Hints language enhancements
Summary: Hints language enhancements
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-03 05:57 UTC by Svata Dedic
Modified: 2015-04-03 11:16 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Svata Dedic 2015-04-03 05:57:19 UTC
Hints language/support enhancements

* conditional hint parts: currently $xxx$; may serve as a placeholder to absorb one or more statements (parts), but sometimes either the conditional part is not suitabel for such treatment, or several parts (i.e. start, end) may be all either present or absent.

* capture position: consider a match with $var placeholder, which will match variable declaration or LValue assignment. Then subsequent $var usages in the match pattern do not provide positional/tree information for the hint, which makes the hint implementor to search for a Tree the AST.

* subtree matches: sometimes it is relevant that a reference to $foo occurs not directly in the block, but "somewhere" inside, even nested in if-while-try blocks.

* negative matches: pattern part, which terminates the search. If subtree matches are supported, a 'restart mark' could be needed so that only part of subtree is ignored.

* pattern priorities and hint exclusions: if it is possible to order patterns, the most relevant hint message would suppress the general ones from the same hint. Also a hint could deliberately suppress more general/suitable other hints when matched.

All the above must be compatible with declarative hints language.

Please give your feedback for the above ideas - I'll probably create a Wiki page for easier collaboration after the initial round.
Comment 1 markiewb 2015-04-03 11:16:26 UTC
(In reply to Svata Dedic from comment #0)
> Hints language/support enhancements
> 

> * conditional hint parts: currently $xxx$; may serve as a placeholder to
> absorb one or more statements (parts), but sometimes either the conditional
> part is not suitabel for such treatment, or several parts (i.e. start, end)
> may be all either present or absent.
> 
I do not understand.

> * capture position: consider a match with $var placeholder, which will match
> variable declaration or LValue assignment. Then subsequent $var usages in
> the match pattern do not provide positional/tree information for the hint,
> which makes the hint implementor to search for a Tree the AST.
> 
Would my issue reported at https://netbeans.org/bugzilla/show_bug.cgi?id=244487

> * subtree matches: sometimes it is relevant that a reference to $foo occurs
> not directly in the block, but "somewhere" inside, even nested in
> if-while-try blocks.
> 

I cannot imagine a usecase yet. Any example?

> * negative matches: pattern part, which terminates the search. If subtree
> matches are supported, a 'restart mark' could be needed so that only part of
> subtree is ignored.
> 
It can already expressed with custom conditions AFAIK. I never used them, but I read about them.
https://bitbucket.org/jlahoda/jackpot30/wiki/RulesLanguageAdditionalDocs

> * pattern priorities and hint exclusions: if it is possible to order
> patterns, the most relevant hint message would suppress the general ones
> from the same hint. Also a hint could deliberately suppress more
> general/suitable other hints when matched.
> 
Yes that would be useful. Perhaps you do not need to invoke the suppressed hint's activation code too.

 
> Please give your feedback for the above ideas - I'll probably create a Wiki
> page for easier collaboration after the initial round.

Yes, a Wiki-page or a shared google drive document would be fine.