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.
Given a c++ class instance 'p' with a member variable 'foo', if I type p. the code completion will suggest the class members, which is correct for java, but wrong for c++. The same thing is true the use of 'this' pointer.
I'm sorry. I think, I don't understand you. Could you, please, provide an example?
class Foo { private: int value; public: void method() { this.value; // type 'this.' and the editor suggests 'value' } }; Foo foo; foo->value++; // type foo-> and the editor suggests 'value' Foo* foo2 = &foo; foo2.value++; // type foo. and the editor suggests 'value'
Thank you for the example. We'll fix this in a future release. BTW, we plan to automatically replace "." to "->" and vice versa if need - see http://cnd.netbeans.org/issues/show_bug.cgi?id=97120
When you do add the automatic correction for . and -> be sure you don't make any changes when both usages are appropriate, such as when operator-> or operator* is defined. However, I this think there is another bug. The editor and the internal compiler thinks that 'this.' is valid, which is entirely independent of code completion.
I agree with your comments. Btw, we support smart pointers in general, so we track overloaded operators *, ->, [] as about "this." I think we need to implement this usecase as part of IZ#97120 in 6.5, because, it could be useful for Java developers (who occasionally needs some C++ coding) to have autoreplacement of their this.f| (choose foo()) into "this->foo()"
*** Issue 160699 has been marked as a duplicate of this issue. ***
*** Issue 103472 has been marked as a duplicate of this issue. ***
*** Bug 180292 has been marked as a duplicate of this bug. ***
I have implemented "." to "->" conversion. looks like the last part is "->" to "." conversion/check
What is the status of this bug? Please evaluate.
This is halfway fixed, IMHO. Here's what is fixed: Inside a class, if I type 'this.', NB changes it into a ->. In fact it appears impossible to type 'this.'. Very nice. Given a pointer to a class 'p', if I type p., it will suggest members, and if I use the auto completion, by hitting enter, it changes the '.' to a '->'. However, problems remain: Given a reference to a class, if I type ->, NB suggests members of class, even though access should only come with '.'. It appears to treat '.' and '->' both as appropriate, even though '->' is incorrect (and there is no overload for ->). Also, the code model shown in the editor window does not point out a problem with using -> on a reference.
My latest comment is based on testing with the version below (not my usual linux) using the WinAVR cross compiler. Product Version: NetBeans IDE 7.2 (Build nbms-and-javadoc-9355-on-20120802) Updates: Updates available Java: 1.6.0_33; Java HotSpot(TM) 64-Bit Server VM 20.8-b03 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) User directory: C:\Users\toddb\AppData\Roaming\NetBeans\7.2 Cache directory: C:\Users\toddb\AppData\Local\NetBeans\Cache\7.2
As above, partly fixed.
> BTW, we plan to automatically replace "." to "->" and vice versa if need - see > http://cnd.netbeans.org/issues/show_bug.cgi?id=97120 This appeared to be partly fixed in 7.2, But is now broken again in the version below. Specifically, -> is no longer replaced with . when it should be, or is . replaced with -> when it should be. See below for specifics. Product Version: NetBeans IDE Dev (Build 201303192300) Java: 1.7.0_17; Java HotSpot(TM) Client VM 23.7-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02 System: Linux version 3.6.11-4.fc16.x86_64 running on i386; UTF-8; en_US (nb) User directory: /home/toddb/.netbeans/dev Cache directory: /home/toddb/.cache/netbeans/dev
Correction: . to -> replacement still works. but -> to . replacement does not.
Todd, Can you provide construction where "->" to "." worked before and broken now? To be fair I've never implemented "->" to "." conversion and current fixes where again in "." to "->" domain :-)
> Can you provide construction where "->" to "." worked before and broken now? No... this was me running into a variety of problems and trying to decide what to report. This is *not* a regression, but it was the easiest one for me to whine about. Sorry to imply otherwise.
It suppose this bug should be closed, because "." to "->" replacement makes sense because it reduces amount of typing. But if someone typed "->" then it almost certain that the object on the lefthand side is pointer or has overloaded operator. Otherwise there is no need to manually type such a long construction (->). Therefore if IDE replaces it to '.' automatically, it will mess up user's code.