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 215371 - Duplicate entries in code completion
Summary: Duplicate entries in code completion
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2012-07-10 16:23 UTC by dmytro
Modified: 2014-02-17 17:09 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Duplicate entries in code completion (68.75 KB, image/jpeg)
2012-07-10 16:24 UTC, dmytro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dmytro 2012-07-10 16:23:13 UTC
Duplicate entries in code completion functionality (see attached image).

-----

Product Version = NetBeans IDE 7.2 RC1 (Build 201206272359)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_04
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.0-b21
Comment 1 dmytro 2012-07-10 16:24:04 UTC
Created attachment 121899 [details]
Duplicate entries in code completion
Comment 2 Ondrej Brejla 2012-07-30 07:05:58 UTC
I've been fixing some "duplicate entries" issue. So please, provide me the simplest reproducible test case. These problems are hard to discover from scratch. Than simply reopen this issue. Thanks.
Comment 3 Sw3rtas 2014-02-12 16:09:48 UTC
This occurs after class redeclaration. For example:
A.php
<?php
class A extends Exception {
    public $exceptionA;
}

A_1.php
<?php
class A extends Exception {
    public $exceptionB;
}

index.php
<?php
$exception = new A('',1);
$exception->
Comment 4 Ondrej Brejla 2014-02-13 09:01:11 UTC
It's another problem. But it's definitely _won't fix_...you really shoudn't have more classes with the same name in same namespace. Especially if one uses some kind of autoloading, it will end up with an error (ambiguous class). It's nonsense and absolutely inconsistent.
Comment 5 Sw3rtas 2014-02-13 09:41:50 UTC
Yes, you are right. I used that approach only for code completion to define dynamic properties/methods for third party classes, served by composer, which I can not edit. However i noticed that i don't need to extend those classes to get auto completion working.

Thanks for the tips.
Comment 6 Sw3rtas 2014-02-13 09:48:19 UTC
But what about:
A.php
<?php
class A extends Exception {
    public $exceptionA;
}

B.php
<?php
class B extends Exception {
    public $exceptionB;
}

index.php
<?php
class index {
    /**
     *
     * @var A|B 
     */
    public $exception;
}
$exception = new index();
$exception->exception->
Comment 7 Ondrej Brejla 2014-02-13 12:40:02 UTC
Ok, that's valid use case.

Fixed in web-main #a93e69750eed
Comment 8 Quality Engineering 2014-02-14 02:53:32 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/a93e69750eed
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #215371 - Duplicate entries in code completion
Comment 9 mmolda 2014-02-17 17:09:43 UTC
Verified. Thanks.

Product Version: NetBeans IDE Dev (Build 201402170649)
Java: 1.8.0; Java HotSpot(TM) 64-Bit Server VM 25.0-b67
Runtime: Java(TM) SE Runtime Environment 1.8.0-b126
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)