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 186314

Summary: Find Usages not working in Netbeans 6.8
Product: editor Reporter: pgazda <pgazda>
Component: RefactoringAssignee: David Strupl <dstrupl>
Status: RESOLVED WORKSFORME    
Severity: normal CC: bdupreez, dstrupl, edburns
Priority: P2    
Version: 6.x   
Hardware: PC   
OS: Other   
Issue Type: DEFECT Exception Reporter:
Attachments: Project for recreating the problem.

Description pgazda 2010-05-18 15:46:20 UTC
Product Version: NetBeans IDE 6.8 (Build 200912041610)
Java: 1.6.0_17; Java HotSpot(TM) Client VM 14.3-b01
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Users\pag\.netbeans\6.8

The Find Usages (for class methods and variables) does not work. It will only find usages within the same class. I think this occurred after the last time I updated the IDE a week or two ago. It had been working before that.

To test that it is not a configuration issue, I re-installed Netbeans 6.7.1 and tried Find Usages for the same methods in the same projects in 6.8 and 6.7.1. Version 6.7.1 finds usages correctly. Version 6.8 does not find usages.
Comment 1 Peter Pis 2010-05-19 08:17:58 UTC
Reassigning.
Comment 2 edburns 2010-05-27 00:04:34 UTC
I observe that it doesn't work even for simple class usages.  For example, I have a free form project that declares class javax.faces.component.UIParameter.  I have another class that uses that class: com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.  When I do Find Usages on UIParameter, I find that it shows 0 usages, even when I can plainly see that the class is being used.

Note that there are no ide compilation warnings in the right margin, or in the Projects tab.

I tried this on NetBeans 6.9 RC1 and 6.8 201003081350.
Comment 3 edburns 2010-05-27 00:06:01 UTC
Oddly enough, Find Usages *does* work for other classes.  Just this UIParameter one doesn't work.

Hmm.

Here's the UIParameter class:


package javax.faces.component;



/**
 * <p><strong>UIParameter</strong> is a {@link UIComponent} that represents
 * an optionally named configuration parameter for a parent component.</p>
 *
 * <p>Parent components should retrieve the value of a parameter by calling
 * <code>getValue()</code>.  In this way, the parameter value can be set
 * directly on the component (via <code>setValue()</code>), or retrieved
 * indirectly via the value binding expression.</p>
 *
 * <p>In some scenarios, it is necessary to provide a parameter name, in
 * addition to the parameter value that is accessible via the
 * <code>getValue()</code> method.
 * {@link javax.faces.render.Renderer}s that support parameter names on their
 * nested {@link UIParameter} child components should document
 * their use of this property.</p>
 *
 */

public class UIParameter extends UIComponentBase {


    // ------------------------------------------------------ Manifest Constants


    /**
     * <p>The standard component type for this component.</p>
     */
    public static final String COMPONENT_TYPE = "javax.faces.Parameter";


    /**
     * <p>The standard component family for this component.</p>
     */
    public static final String COMPONENT_FAMILY = "javax.faces.Parameter";


    enum PropertyKeys {
        name,
        value,
        disble
    }


    // ------------------------------------------------------------ Constructors


    /**
     * <p>Create a new {@link UIParameter} instance with default property
     * values.</p>
     */
    public UIParameter() {

        super();
        setRendererType(null);

    }


    // -------------------------------------------------------------- Properties


    public String getFamily() {

        return (COMPONENT_FAMILY);

    }


    /**
     * <p>Return the optional parameter name for this parameter.</p>
     */
    public String getName() {

        return (String) getStateHelper().eval(PropertyKeys.name);

    }


    /**
     * <p>Set the optional parameter name for this parameter.</p>
     *
     * @param name The new parameter name,
     *  or <code>null</code> for no name
     */
    public void setName(String name) {

        getStateHelper().put(PropertyKeys.name, name);

    }



    /**
     * <p>Returns the <code>value</code> property of the
     * <code>UIParameter</code>.</p>
     */
    public Object getValue() {

        return getStateHelper().eval(PropertyKeys.value);

    }


    /**
     * <p>Sets the <code>value</code> property of the\
     * <code>UIParameter</code>.</p>
     *
     * @param value the new value
     */
    public void setValue(Object value) {

        getStateHelper().put(PropertyKeys.value, value);

    }

    /**
     * <p class="changed_added_2_0">Return the value of the <code>disable</code>
     * directive for this component. This directive determines whether the
     * parameter value should be disabled by assigning it a null value.
     * If true, the <code>value</code> set on this component is ignored.</p>
     * @since 2.0
     */
    public boolean isDisable() {

        return (Boolean) getStateHelper().eval(PropertyKeys.disble, false);

    }

    /**
     * <p>Sets the <code>disable</code> property of the <code>UIParameter</code>.</p>
     * @param disable
     * @since 2.0
     */
    public void setDisable(boolean disable) {

        getStateHelper().put(PropertyKeys.disble, disable);

    }


}
Comment 4 pbowyer 2010-06-07 22:00:48 UTC
I'm also finding this not working as it once did, however it does work partially. For instance in library class files that are built for inclusion into a larger project (as a Jar), I can find usages within the Source Package containing the classes comprising that library, but I cannot find usages in the main project that uses that library even when the scope is set to Open Projects.

My installation is on a PCLinuxOS-2009.2 system using KDE3.5.10.

As a work-around, I've resorted to using "Find in Projects" Ctrl+Shift-F but it's much less useful.

I don't remember when this started, but the same behavior occurs in Release 6.9rc2, which I'm still evaluating.
Comment 5 pbowyer 2010-06-08 00:07:18 UTC
In addition to my last comment on this report, this is effecting refactoring for Release 6.8 (and I suspect also for Release 6.9rc2 but I haven't checked).

When I try to change the name of a method in a library class via refactoring, it cannot find the usages in the main project. It requires manually updating the method calls in the main project, which can be found after the refactor because they show up as errors.
Comment 6 edburns 2010-06-09 15:43:13 UTC
Here is some content to justify raising this to a P2.

This bug caused me some grief when working with an important customer in Oracle Apps.  Here's an email exchange.

>>>>> On Tue, 08 Jun 2010 13:08:04 -0400, Andy said:

AS> 1.  StateManagementStrategyImpl.restoreView() is still delivering 
AS> PostRestoreStateEvents.

Wow, talk about the upstream impact of a tool bug.  

I reported that NetBeans 6.9 RC1 was giving inconclusive results on its
"find usages" command.  [1].  Naturally, I used find/grep to try to
catch all the usages, but this is one I missed.

AS> This code needs to be removed now that we are handling this centrally in 
AS> RestoreViewPhase.

Thanks, I've removed it.  To add gravity to the bug fix for [1], I have
also added this text to the bug report.
Comment 7 David Strupl 2010-07-29 12:09:02 UTC
I am sorry but I mark the bug report as incomplete. We would need the self containing steps to reproduce the wrong behavior. One possible issue might be that the projects in question are not set up correctly (with proper dependencies).

I understand it might be hard to get to us all the relevant files but we would need to have the projects where it doesn't work + the user dir of the installation of NetBeans to figure this out. Or steps from a clean installation to the wrong state if the steps can be reproduced.
Comment 8 pgazda 2010-07-30 17:05:45 UTC
Created attachment 101128 [details]
Project for recreating the problem.

Extract zip files. Under JavaClasses directory, open Netbeans project ldapSvcs_sample2. Read HowToCreateProblem.txt.
Comment 9 David Strupl 2010-07-30 17:40:02 UTC
Ok, marking as reopened after the files have been added.
Comment 10 Jan Lahoda 2010-08-04 09:18:22 UTC
I have tried the project on a dev (post 6.9) build and on NetBeans 6.8, but unfortunatelly I was not able to reproduce the problem - all three occurrences were found in both cases.
Comment 11 pgazda 2010-08-04 15:02:27 UTC
Maybe it was the specific 6.8 build that I have installed, or a range of builds around that time, because the problem is very consistent for me. I will install 6.9 and see how my test works there.
Comment 12 pgazda 2010-08-09 16:50:11 UTC
I have installed Product Version: NetBeans IDE 6.9.1 (Build 201007282301) and tried my test. It works correctly on 6.9.1. I remember that the problem in 6.8 seemed to start after I installed one of the updates that Netbeans prompted me to install, so I think the problem was specific to that release and was fixed in a subsequent build. Thank you for looking into it. Sorry it has proven to be a false alert.
Comment 13 bdupreez 2010-08-11 05:26:19 UTC
I came across this is yesterday, in version 6.9, downloaded and installed NetBeans IDE 6.9.1 (Build 201007282301) this morning to test if I still get the same issue. Unfortunately the same still occurs...

I can ctrl+click navigate to the code, select the method, "Find Usages" and it finds 0 occurrences of the reference that I just navigated from.
Comment 14 David Strupl 2010-08-26 13:48:46 UTC
As per the original reporter claim I am closing this issue as "works for me". Is someone is able to reproduce please attach your project where it can be seen either in 6.9(.1) or 6.10 dev builds ... Thansk for helping us to make the IDE better.
Comment 15 bdupreez 2010-08-27 04:21:18 UTC
Hi, it may be "working on my machine", being a developer I understand without an example to recreate it there isn't much that can be done, but it still doesn't work for me and unfortunately I can't add my projects as examples, all together it is roughly 13000 java files ... and all confidential obviously.

I'll go back to netbeans again if I change jobs/teams/environment.