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 - String.indexOf can be replaced with String.contains
Summary: String.indexOf can be replaced with String.contains
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 8 x64
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-10 19:25 UTC by akobberup
Modified: 2014-02-14 02:53 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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