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 246211 - Netbeans fails to provide autocomplete on objects passed to type-hinted anonymous functions within a class
Summary: Netbeans fails to provide autocomplete on objects passed to type-hinted anony...
Status: RESOLVED DUPLICATE of bug 268825
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Tomas Mysik
Depends on:
Reported: 2014-08-03 00:28 UTC by TheTechFan
Modified: 2017-04-12 05:51 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Relatively minimal testcase (825 bytes, application/octet-stream)
2014-08-03 00:30 UTC, TheTechFan
Modified testcase (1.04 KB, application/octet-stream)
2014-08-03 16:45 UTC, TheTechFan
Sshot (96.85 KB, image/png)
2014-08-03 19:49 UTC, Ondrej Brejla
Screenshot of bug (105.19 KB, image/png)
2014-08-03 20:46 UTC, TheTechFan
Screenshot from 20140804 nightly (106.21 KB, image/png)
2014-08-05 05:30 UTC, TheTechFan
Screenshot from 20140805 nightly (103.54 KB, image/png)
2014-08-05 14:23 UTC, TheTechFan
Screenshot taken on a 3rd machine from the 2014-08-07 nighly (144.42 KB, image/png)
2014-08-07 21:45 UTC, TheTechFan

Note You need to log in before you can comment on or make changes to this bug.
Description TheTechFan 2014-08-03 00:28:39 UTC
Product Version = NetBeans IDE Dev (Build 201408020001)
Operating System = Windows 8 version 6.2 running on amd64
Java; VM; Vendor = 1.8.0_11
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.11-b03

See testcase.
Comment 1 TheTechFan 2014-08-03 00:30:30 UTC
Created attachment 148488 [details]
Relatively minimal testcase
Comment 2 TheTechFan 2014-08-03 00:35:49 UTC
This bug occurs in Netbeans 8.0, as well.
Comment 3 Ondrej Brejla 2014-08-03 07:25:32 UTC
Works for me properly in the dev build. Try to delete your userdir/cached index and force NB to reindex whole sources. I think that there were some changes in parsing infrastructure.

Product Version: NetBeans IDE Dev (Build 20140803-a5ccc9a75f08)
Java: 1.8.0_11; Java HotSpot(TM) 64-Bit Server VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12
System: Mac OS X version 10.9.4 running on x86_64; UTF-8; cs_CZ (nb)
Comment 4 TheTechFan 2014-08-03 16:31:33 UTC
It still doesn't work for me. I tried closing my projects, deleting the cache, and creating a new project containing only the testcase.php file, but NetBeans still doesn't autocomplete properties/methods on the $case variable (when I type `$case->` inside the callback function, NetBeans does not suggest the getInfo() method or public $property).
Comment 5 TheTechFan 2014-08-03 16:45:37 UTC
Created attachment 148496 [details]
Modified testcase

If a separate (completely unrelated) $case variable is defined outside the callback, NetBeans incorrectly autocompletes its properties/methods inside the callback.
Comment 6 Ondrej Brejla 2014-08-03 19:49:14 UTC
Created attachment 148501 [details]

Sorry, still works properly in the dev build.
Comment 7 TheTechFan 2014-08-03 20:46:26 UTC
Created attachment 148503 [details]
Screenshot of bug

What in the world is making it behave differently for me? Screenshot taken from a clean install of today's nightly with a new project.
Comment 8 TheTechFan 2014-08-03 21:53:23 UTC
Is there some setting that might affect this? Is it a difference between the PC and Mac versions? What could be causing this bug?
Comment 9 Ondrej Brejla 2014-08-04 07:46:09 UTC
Imho not, there must be something wrong with your index. Don't know what...normally clean install should help (or deleting userdir and cache dir).
Comment 10 TheTechFan 2014-08-05 05:30:27 UTC
Created attachment 148538 [details]
Screenshot from 20140804 nightly

I downloaded the 20140804 nightly and started with a clean install, fresh profile, and new project. In this version NetBeans no longer suggests members of the unrelated variable, but it still fails to provide autocomplete suggestions for the TestCase class. @Ondrej could you test this in the very latest nightly build on Windows with a clean install of NetBeans? Perhaps it's a recent regression.
Comment 11 TheTechFan 2014-08-05 14:23:00 UTC
Created attachment 148562 [details]
Screenshot from 20140805 nightly

I just performed a clean install of the 20140805 nightly on a different PC and the issue occurs there as well. There is definitely a bug here.
Comment 12 TheTechFan 2014-08-07 21:45:50 UTC
Created attachment 148596 [details]
Screenshot taken on a 3rd machine from the 2014-08-07 nighly
Comment 13 TheTechFan 2014-08-07 21:49:00 UTC
I tried installing the NetBeans 2014-08-07 nightly on a *third* machine, this time as an upgrade from 8.0. I tried the modified testcase in both an existing project and a new project, and the issue was reproducible in both cases. There is definitely a bug of some sort here!

If possible please test the latest nightly on Windows if you can't reproduce it on a Mac. I don't have a Mac to test.
Comment 14 Tomas Mysik 2016-06-10 10:49:48 UTC
It works for me as well in the current dev build. Please, as written before, ensure that you delete your Cache directory [1] first, then start NetBeans and wait till it scans & indexes your sources and try it again.

[1] See Help > About adialog, Cache directory

Product Version: NetBeans IDE Dev (Build 20160610-49331e2a0591)
Java: 1.8.0_91; Java HotSpot(TM) 64-Bit Server VM 25.91-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_91-b14
System: Linux version 4.2.0-38-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 15 TheTechFan 2016-09-18 17:22:14 UTC
This is still broken even in the Netbeans 8.2 release candidate.

Try opening the Modified testcase file in a project. On line 25, try typing `$case->` and notice that instead of suggesting the property and method of the `TestCase` object, Netbeans incorrectly suggests the `test` method of the `TestCaseUser` class.
Comment 16 junichi11 2017-04-12 05:51:02 UTC
I hope this is fixed with the issue 268825. So please try to test it in the dev build.


*** This bug has been marked as a duplicate of bug 268825 ***