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 241657

Summary: String.indexOf can be replaced with String.contains
Product: java Reporter: akobberup
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 8 x64   
Issue Type: DEFECT Exception Reporter:

Description akobberup 2014-02-10 19:25:33 UTC
the folowing code: boolean containsPeriod = new StringBuilder("some text").indexOf(".") >= 0;

will make nb show this hint: String.indexOf can be replaced with String.contains

Which is correct - but the code do not contain String.indexOf - it contains StringBuilder.indexOf
Comment 1 Svata Dedic 2014-02-11 19:26:56 UTC
missing constraints on the method's declaring class; thanks for catching this.

fixed in jet-main#536ab10a4efa
Comment 2 Quality Engineering 2014-02-14 02:53:02 UTC
Integrated into 'main-silver', will be available in build *201402140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/536ab10a4efa
User: Svata Dedic <sdedic@netbeans.org>
Log: #241657: index > contains only suggested for String objects