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 254353 - Find usages does not find method uses when chaining methods in some specific order
Summary: Find usages does not find method uses when chaining methods in some specific ...
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.1
Hardware: PC Linux
: P1 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-13 19:48 UTC by Michel Graciano
Modified: 2015-08-17 13:12 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample project (2.87 KB, application/zip)
2015-08-13 19:48 UTC, Michel Graciano
Details
Screenshot (157.78 KB, image/png)
2015-08-14 08:03 UTC, Ralph Ruijs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2015-08-13 19:48:06 UTC
Created attachment 155331 [details]
Sample project

It is not easy to describe, so I am attaching a sample project to simulate the issue. For further search, the problem happens when I use BigDecimal constants from a utility class located in the test folder. If I use constants from BigDecimal itself of local constants, it works as expected.

To reproduce the problem follow these steps:
1. Open the project and the class SampleClassTest.java
2. Ask the IDE to find usages for sampleMethod2()
3. The expected result is no occurrences
4. Now, comment out the line 14 and repeat step 2
5. Now you will be able to the the correct result, with 1 occurrence

I haven't tried it yet in 8.0.2 or 8.1, just in daily builds.

Product Version: NetBeans IDE Dev (Build 20150811-1eb09322782a)
Java: 1.8.0_51; Java HotSpot(TM) 64-Bit Server VM 25.51-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_51-b16
System: Linux version 3.4.63-2.44-desktop running on amd64; UTF-8; en_US (nb)
Comment 1 Michel Graciano 2015-08-13 19:50:58 UTC
I think it is a P1 because it is really hard to reproduce and it breaks a lot of features, like method rename and so on. There is no easy way to fix it, just refactoring all the code that uses this pattern.

Other way to make the find usages work is switch the code at line 15 with 14.
Comment 2 Ralph Ruijs 2015-08-14 08:03:19 UTC
Created attachment 155336 [details]
Screenshot

The tree type is not resolved. Class is <any> and type is ERROR.
Comment 3 Ralph Ruijs 2015-08-14 08:04:45 UTC
Reassigning to java.source, please evaluate. Thanks!
Comment 4 Svata Dedic 2015-08-14 10:04:14 UTC
I cannot reproduce the errors in the tree. Yellow underline for package statement is probably caused by missing artifact in maven local repo - run a priming build. When I primed Maven and then incidentally restarted the IDE with cleaned caches (and waited for the background scan to finish) I still could not find any usages of sampleMethod2().
Comment 5 Ralph Ruijs 2015-08-14 13:44:05 UTC
changeset:   f586d574f534
user:        Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date:        Fri Aug 14 15:30:17 2015 +0200
summary:     #254344 / #254353 - Using the classpath from one src root is not enough
Comment 6 Quality Engineering 2015-08-15 01:58:57 UTC
Integrated into 'main-silver', will be available in build *201508150002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f586d574f534
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #254344 / #254353 - Using the classpath from one src root is not enough
Comment 7 Michel Graciano 2015-08-17 13:12:43 UTC
v. Build 20150817-c02dc2608c53