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 234089 - Patch for: [Replace String.indexOf] Hint can recognize more patters
Summary: Patch for: [Replace String.indexOf] Hint can recognize more patters
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Svata Dedic
URL:
Keywords: PATCH_AVAILABLE
Depends on: 239119
Blocks:
  Show dependency tree
 
Reported: 2013-08-07 15:02 UTC by Jiri Prox
Modified: 2013-12-04 16:25 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed patch (8.76 KB, patch)
2013-08-25 18:07 UTC, markiewb
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2013-08-07 15:02:50 UTC
Replace String.indexOf with String.contains hint should recognize more patters as

s.indexOf("")==-1    // e.g. without brace
s.indexOf("")>-1
s.indexOf("")>=0



Product Version: NetBeans IDE Dev (Build 201308042300)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b40
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b98
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 1 markiewb 2013-08-25 18:07:45 UTC
Created attachment 139213 [details]
Proposed patch

I like to propose a patch to solve this issue. Please review, try and commit.

The patch adds more patterns and also includes unit tests.
Comment 2 Svata Dedic 2013-12-04 15:50:08 UTC
As for parenthesis - this deserves IMHO a way better support in the pattern matching infrastructure; there's a lot of places, where the subexpression could be unnecessarily enclosed in parenthesis for aesthetical reasons.

As for the patch itself; I think the check in the method (right now just decides based on == EQUALS) needs to be improved a little.
Comment 3 Svata Dedic 2013-12-04 16:25:12 UTC
Integrated in http://hg.netbeans.org/jet-main/rev/92c1b980f733