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 201452

Summary: Problem with equally named classes in different namespaces
Product: php Reporter: TrebleSnake
Component: EditorAssignee: Ondrej Brejla <obrejla>
Status: VERIFIED FIXED    
Severity: normal CC: pjiricka, vriha
Priority: P2    
Version: 7.0.1   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 201153    

Description TrebleSnake 2011-08-30 19:04:27 UTC
Hello, looks like there is a problem with namespaces.
So, for example, we have 2 namespaces: Core and Data.
And we have 2 classes with equal names (e.g. User) in those namespaces.

And there is a method in \Core\User:

/**
* Some method in \Core\User, wich has a \Data\User as an argument.
* @param \Data\User $var1
*/
public function TheMethod($var1)
{
  //And here I simply create a new object of \Data\User class
 $var2 = new \Data\User();
}

And when I write "$var1->" or "$var2->" and press Ctrl+Space, properties and methods of \Data\User are supposed to appear. But I see autocomplete for \Core\User class. And it makes me very-very sad. :) So, here is the bug.

But, by the way, as soon as I create an alias for \Data\User and use alias, it works properly.
Comment 1 Petr Pisl 2011-09-02 09:23:48 UTC
I have tried your example with the dev build and I see in the code completion item list methods from both User classes. Do you see only from the Core\User?
Comment 2 TrebleSnake 2011-09-02 21:05:13 UTC
(In reply to comment #1)
> I have tried your example with the dev build and I see in the code completion
> item list methods from both User classes. Do you see only from the Core\User?

I use stable build 7.0.1 (Build 201107282000), and yes, I see completion items only from the Core\User.
Comment 3 Ondrej Brejla 2011-09-07 14:43:02 UTC
I see methods and properties from both classes NB 7.0.1...and it's annoying too ;) Same behaviour in NB 7.1dev.
Comment 4 Petr Pisl 2011-09-08 12:05:18 UTC
I have find out that if you split the namespaces into two separate files, then code completion really offers only the methods from Core\User class.
Comment 5 Ondrej Brejla 2011-09-09 12:54:48 UTC
Fixed in web-main: http://hg.netbeans.org/web-main/rev/b76268950355
Comment 6 Quality Engineering 2011-09-10 14:25:25 UTC
Integrated into 'main-golden', will be available in build *201109100600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b76268950355
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #201452 - Problem with equally named classes in different namespaces
Comment 7 Vladimir Riha 2011-09-23 11:33:20 UTC
verified