You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Erick Erickson (Resolved) (JIRA)" <ji...@apache.org> on 2011/12/04 02:32:40 UTC

[jira] [Resolved] (SOLR-2876) Precedence operator in conditionals with ternary operator needs to be examined.

     [ https://issues.apache.org/jira/browse/SOLR-2876?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Erick Erickson resolved SOLR-2876.
----------------------------------

    Resolution: Not A Problem

The other precedences are OK, as far as I can tell... not worth messing around in the code for no demonstrable benefit.
                
> Precedence operator in conditionals with ternary operator needs to be examined.
> -------------------------------------------------------------------------------
>
>                 Key: SOLR-2876
>                 URL: https://issues.apache.org/jira/browse/SOLR-2876
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 3.5, 4.0
>         Environment: all
>            Reporter: Erick Erickson
>            Assignee: Erick Erickson
>            Priority: Trivial
>              Labels: operator, precedence, ternary
>         Attachments: SOLR-2876.patch
>
>
> This is an offshoot of 2829 where the root of the bug was that precedence in the ternary operator along with && without appropriate parentheses was a problem.
> && this.parser == null ? other.parser == null : this.parser.getClass() == other.parser.getClass() (from ShortFieldSource.java).
> So that got me curious whether this pattern was repeated. A quick grep with the following REs produced one hit I wasn't related to 2829 with && and more with || (3x code base). I'll try to get to it over the weekend. Please don't grab it just yet, I'm fixing this partially for 2829, but if anyone wants to try the grep and see if I'm hallucinating, I'd appreciate it. I'd *really* appreciate any tests for things people see...
> Some of the returns are false hits, but not others. See 
> SolrIndexSearcher.getDocListAndSetNC() 
> the last line is: return pf.filter==null && pf.postFilter==null ? qr.getDocSet() : null; 
> REs (using them in IntelliJ)
> \|\|[\sa-z\.0-9A-Z]+==.*\?
> &&[\sa-z\.0-9A-Z]+==.*\?
> I got some hits with the above and didn't pursue it any further, but if anyone wants to suggest more comprehensive REs, please attach. I'm trying for "&& or || followed by anything without an open parentheses followed by == followed by anything followed by ?" I'd rather get a manageable number of false positives than miss things.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org