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 240609 - Go to declaration bug
Summary: Go to declaration bug
Status: RESOLVED WORKSFORME
Alias: None
Product: php
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal with 2 votes (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-17 14:20 UTC by GreenDrake
Modified: 2016-11-18 11:01 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Cleaned part of very big project (5.02 KB, application/x-zip-compressed)
2014-01-17 17:27 UTC, GreenDrake
Details

Note You need to log in before you can comment on or make changes to this bug.
Description GreenDrake 2014-01-17 14:20:32 UTC
"Go to declaration" (CTRL+Click or CTRL+B) wont work correctly with non declared objects.
This happens since version NetBeans 7.4 (7.3 and 7.3.1 works good).

Code example:

$cache = itk_service('Lms2_Data_LoCache'); // Lms2_Data_LoCache
$oLo = $cache->get_lo($this->lo_id); // Lms_Lo
$mode = $oLo->getActivationMode($this->user_id);

This project works perfect in NB 7.3.1 and fails to properly using "Go to declaration" feature in 7.4 (tested in 8 beta - same result):

NB 7.3: "Go to declaration" on 'get_lo' opens hover window with 3 different methods in 3 different classes, on method 'getActivationMode' it correctly opens class $oLo and goes to the right method.
NB 7.4: Go to declaration on 'get_lo' method doesn't work (it did not even highlighted when you select them), but on method 'getActivationMode' it works as it should be (NB 7.3).
As you can see - both of objects is not declared directly.

Important notes:
- Method 'get_lo' occurs in the project 3 times
- Method 'getActivationMode' occurs in the project 1 times
- Quick search shows all these methods in list, so I making assume that indexing is fine.

Please let me know if you need additional info.
Comment 1 Ondrej Brejla 2014-01-17 15:46:26 UTC
I need sample (the smallest one) project where it can be reproduced. Then simply reopen. Thanks.
Comment 2 Ondrej Brejla 2014-01-17 15:50:55 UTC
Just one note, if itk_service() doesn't return proper object type, go to declaration can't (and will not) work. If it worked in previous versions it was just a side effect of a bug (unintended behavior) where all "same called" functions were suggested regardless their proper type. You can use var doc to set a proper type to $cache variable.

/* @var $cache Lms2_Data_LoCache */ //with fully qualified name
$oLo = $cache->get_lo($this->lo_id); // then gtd will work
Comment 3 GreenDrake 2014-01-17 17:27:46 UTC
Created attachment 144088 [details]
Cleaned part of very big project
Comment 4 GreenDrake 2014-01-17 18:15:10 UTC
1. Attached test project with mentioned code part.

2.
> Just one note, if itk_service() doesn't return proper object type, go to declaration can't (and will not) work.

I cant say that all of them returns only objects (not even talking about _proper_ objects). And IDE can't really help in this situation other than enumerate all found methods (in my situation - sometimes around 10-20) with the same name. 

> If it worked in previous versions it was just a side effect of a bug (unintended behavior) where all "same called" functions were suggested regardless their proper type.

I'm sorry, but it's PHP and how IDE can find which objects is inherited from right classes or directly the ones that we are looking? (Except @var tag of course.)
By the way - 2 of 3 classes in my attachment for $cache->get_lo in fact returns valid objects, but GTD didn't work at all with it.

And yes - this bug appeared about the time when 7.4 beta was released.

> You can use var doc to set a proper type to $cache variable.
> /* @var $cache Lms2_Data_LoCache */ //with fully qualified name

Thanks, this works fine - I checked this before creating a task, but forgot to mention.
Comment 5 GreenDrake 2014-01-17 18:36:24 UTC
Tested in clean OS with Windows 8.1, JDK 1.7.0_51 and NetBeans 7.3-7.4.
Problem persists.
Comment 6 mvlad7402 2014-09-14 21:24:37 UTC
What info do you guys need to fix this issue with php search. I'm tired to use 7.3.1 when 8.0.1 available. I have an project which search great in 7.3.1, but since 7.4 php "go to declaration" or ctrl+ mouse just dead.
Comment 7 andyr_it 2014-09-15 10:15:03 UTC
version 8.0.1 PHP version
The "Go to declaration" (CTRL+Click or CTRL+B) has stopped working following this update (update initiated via the IDE update check).

This certainly appears to be a bug as I cannot even click through to the parent of the current class or to classes in 'new' declarations.

This function worked fine in 8.0
Comment 8 Vladimir Riha 2014-09-15 10:51:56 UTC
(In reply to andyr_it from comment #7)
> version 8.0.1 PHP version
> The "Go to declaration" (CTRL+Click or CTRL+B) has stopped working following
> this update (update initiated via the IDE update check).
> 
> This certainly appears to be a bug as I cannot even click through to the
> parent of the current class or to classes in 'new' declarations.
> 
> This function worked fine in 8.0

This is could be issue 247026. Try to delete your cache directory as described in https://netbeans.org/bugzilla/show_bug.cgi?id=247026#c3 .
Comment 9 andyr_it 2014-09-15 12:00:13 UTC
(In reply to Vladimir Riha from comment #8)
> (In reply to andyr_it from comment #7)
> > version 8.0.1 PHP version
> > The "Go to declaration" (CTRL+Click or CTRL+B) has stopped working following
> > this update (update initiated via the IDE update check).
> > 
> > This certainly appears to be a bug as I cannot even click through to the
> > parent of the current class or to classes in 'new' declarations.
> > 
> > This function worked fine in 8.0
> 
> This is could be issue 247026. Try to delete your cache directory as
> described in https://netbeans.org/bugzilla/show_bug.cgi?id=247026#c3 .

Clearing the cache has resolved the issue.

Thank you
Comment 10 mvlad7402 2014-09-15 14:23:17 UTC
I deleted cache dir, but the issue is still there - search does not work.
We need to fix this. Lets work on it.
Comment 11 vlukovni_01 2014-09-19 07:31:06 UTC
Have a same problem.

Afeter update (auto vi system menu Help->Check update) from 8.0.0 -> 8.0.1, broke the following functions:

- jump to declaration;
- quick search (right top search form);
- any popup help;


Product Version         = NetBeans IDE 8.0.1 (Build 201408251540) (#279f174c0395)
Operating System        = Linux version 3.13.0-35-generic running on amd64
Java; VM; Vendor        = 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03; Oracle Corporation
Runtime                 = Java(TM) SE Runtime Environment 1.7.0_51-b13
Java Home               = /usr/lib/jvm/java-7-oracle/jre

  System Locale; Encoding = ru_RU (nb); UTF-8
  Home Directory          = /home/user
  Current Directory       = /home/user
  User Directory          = /home/user/.netbeans/8.0rc1
  Cache Directory         = /home/user/.cache/netbeans/8.0rc1
  Installation            = /home/user/netbeans-8.0rc1/nb
                            /home/user/netbeans-8.0rc1/ergonomics
                            /home/user/netbeans-8.0rc1/ide
                            /home/user/netbeans-8.0rc1/extide
                            /home/user/netbeans-8.0rc1/java
                            /home/user/netbeans-8.0rc1/apisupport
                            /home/user/netbeans-8.0rc1/webcommon
                            /home/user/netbeans-8.0rc1/websvccommon
                            /home/user/netbeans-8.0rc1/enterprise
                            /home/user/netbeans-8.0rc1/mobility
                            /home/user/netbeans-8.0rc1/profiler
                            /home/user/netbeans-8.0rc1/php
                            /home/user/netbeans-8.0rc1/harness
                            /home/user/netbeans-8.0rc1/cnd
                            /home/user/netbeans-8.0rc1/dlight
                            /home/user/netbeans-8.0rc1/groovy
                            /home/user/netbeans-8.0rc1/javacard
                            /home/user/netbeans-8.0rc1/javafx
                            /home/user/netbeans-8.0rc1/platform

  Boot & Ext. Classpath   = /usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/classes:/usr/lib/jvm/java-7-oracle/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/dnsns.jar
  Application Classpath   = /home/user/netbeans-8.0rc1/platform/lib/boot.jar:/home/user/netbeans-8.0rc1/platform/lib/org-openide-modules.jar:/home/user/netbeans-8.0rc1/platform/lib/org-openide-util.jar:/home/user/netbeans-8.0rc1/platform/lib/org-openide-util-lookup.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/boot_ja.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/boot_pt_BR.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/boot_ru.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/boot_zh_CN.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-modules_ja.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-modules_pt_BR.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-modules_ru.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-modules_zh_CN.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-util_ja.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-util-lookup_ja.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-util-lookup_pt_BR.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-util-lookup_ru.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-util-lookup_zh_CN.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-util_pt_BR.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-util_ru.jar:/home/user/netbeans-8.0rc1/platform/lib/locale/org-openide-util_zh_CN.jar:/usr/lib/jvm/java-7-oracle/lib/dt.jar:/usr/lib/jvm/java-7-oracle/lib/tools.jar
  Startup Classpath       = /home/user/netbeans-8.0rc1/platform/core/org-openide-filesystems.jar:/home/user/netbeans-8.0rc1/platform/core/core.jar:/home/user/netbeans-8.0rc1/platform/core/locale/org-openide-filesystems_zh_CN.jar:/home/user/netbeans-8.0rc1/platform/core/locale/core_zh_CN.jar:/home/user/netbeans-8.0rc1/platform/core/locale/core_ru.jar:/home/user/netbeans-8.0rc1/platform/core/locale/org-openide-filesystems_ja.jar:/home/user/netbeans-8.0rc1/platform/core/locale/org-openide-filesystems_ru.jar:/home/user/netbeans-8.0rc1/platform/core/locale/core_ja.jar:/home/user/netbeans-8.0rc1/platform/core/locale/core_pt_BR.jar:/home/user/netbeans-8.0rc1/platform/core/locale/org-openide-filesystems_pt_BR.jar:/home/user/netbeans-8.0rc1/nb/core/org-netbeans-upgrader.jar:/home/user/netbeans-8.0rc1/nb/core/locale/core_nb_zh_CN.jar:/home/user/netbeans-8.0rc1/nb/core/locale/core_nb_pt_BR.jar:/home/user/netbeans-8.0rc1/nb/core/locale/core_nb_ru.jar:/home/user/netbeans-8.0rc1/nb/core/locale/core_nb_ja.jar:/home/user/netbeans-8.0rc1/nb/core/locale/org-netbeans-upgrader_zh_CN.jar:/home/user/netbeans-8.0rc1/nb/core/locale/org-netbeans-upgrader_ja.jar:/home/user/netbeans-8.0rc1/nb/core/locale/org-netbeans-upgrader_ru.jar:/home/user/netbeans-8.0rc1/nb/core/locale/org-netbeans-upgrader_pt_BR.jar:/home/user/netbeans-8.0rc1/nb/core/locale/core_nb.jar
Comment 12 Vladimir Riha 2014-09-19 07:35:26 UTC
@vlukovni_01: Please try to close NetBeans, delete cache dir /home/user/.cache/netbeans/8.0rc1 and start NetBeans again.
Comment 13 mvlad7402 2014-09-26 16:01:06 UTC
Vladimir, I did delete cache directory again - still search doesn't work. Let me know when you have a time I can share screen on skype or you can remote to my machine and see/debug by yourself.
Regards, Vlad
Comment 14 mvlad7402 2014-09-26 16:38:22 UTC
Look like I found starting point. Search doesn't work in my old project which was created several years ago with NB 6.x. Search is fine for new project created in NB 8.x. Now we need to figure out how to import/alter old project for search to work.
Thx, Vlad
Comment 15 Tomas Mysik 2016-06-10 11:21:42 UTC
Closing this issue as it seems to me that cleaning the cache directory helps. Please, submit a new issue for any other unrelated comments.

Thanks.
Comment 16 russkiy 2016-11-18 11:01:57 UTC
In my case the problem was fixed after clean build of this (Maven) project. And no, removing cache caused zero effect.