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 98780 - Code Completion returns No suggestions
Summary: Code Completion returns No suggestions
Status: CLOSED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Completion (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-23 12:19 UTC by Jiri Prox
Modified: 2007-12-13 10:01 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stack trace (1.78 KB, text/plain)
2007-03-23 14:07 UTC, Jiri Prox
Details
log (24.26 KB, text/plain)
2007-03-23 15:38 UTC, Jiri Prox
Details
Header file (296 bytes, text/plain)
2007-03-30 11:08 UTC, Jiri Prox
Details
class view for missed ";" (4.18 KB, application/octet-stream)
2007-03-30 13:58 UTC, Vladimir Voskresensky
Details
class view for missed ";" (4.18 KB, image/png)
2007-03-30 13:58 UTC, Vladimir Voskresensky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2007-03-23 12:19:19 UTC
NetBeans IDE Dev (Build 200703211900)
1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
Linux version 2.6.5-1.358 running on i386
en_US (nb); UTF-8
CND Build070322

Code completion return no suggestion for 

Steps to reproduce:
1) have .h file:
class Stack {
    public:
        Stack();        
        int pop();        
        void push(int val);        
        bool isEmpty();
    private:
            class StackItem {
                public:
                    int _item;
                    StackItem *_next;
                    
                    StackItem(int item, StackItem *next) {
                        _item = item;
                        _next = next;
                    }                    
            };            
            StackItem *top;
};

2) have a .cc file containing (among others) following method, .h is included.
int Stack::pop() {         
    if(top==NULL) throw NULL;
    else {
        StackItem *akt = top;
        top = akt->_next;
        return akt->_item;
    }
}

-> code completion after akt-> returns "No suggestions"
-> the whole file is compilable and works fine.
Comment 1 Vladimir Voskresensky 2007-03-23 12:44:31 UTC
Hello,
thank you for reporting!

I created empty Application
added newfile.h with provided Stack class
then created newfile.cc and added
#include "newfile.h"

int Stack::pop() {         
    if(top==NULL) throw NULL;
    else {
        StackItem *akt = top;
        top = akt->_next;
        return akt->_item;
    }
}

in my case I have completion in both cases after akt.
Can you reproduce "No suggestion" with the above scenario in your version?

Thanks in advance,
Vladimir.
Comment 2 Jiri Prox 2007-03-23 14:05:13 UTC
No, it's not reproducible when the whole code is copy&pasted. But when I tried
another example it occurred again. I also noticed that there is exception thrown
sometimes  code completion is invoked. This does not happen in project where
completion returns expected items. (stacktrace is attached).

After IDE restart it works fine.

What I did:
1) create new C++ project
2) create new main file
3) create new header file
4) write class definition in the .h file
5) include <iostream> and "using namespace std;"
6) implement class method in .cc file


Comment 3 Jiri Prox 2007-03-23 14:07:02 UTC
Created attachment 39867 [details]
stack trace
Comment 4 Vladimir Voskresensky 2007-03-23 15:01:38 UTC
thanks for stack trace.

what about original problem?
Does it have any exceptions in log file as well and it is the same?
Comment 5 Jiri Prox 2007-03-23 15:37:27 UTC
Seems the mentioned exception is not related to this problem. But in the log,
there is different one.
Comment 6 Jiri Prox 2007-03-23 15:38:21 UTC
Created attachment 39876 [details]
log
Comment 7 Vladimir Voskresensky 2007-03-23 15:46:39 UTC
thank you!
from this log the original problem is visible.

Could you please file separate IZ for NPE problem, because it's different problem.

Thanks,
Vladimir.
Comment 8 Vladimir Voskresensky 2007-03-30 11:01:05 UTC
Could you, please, attach the content of file 
Application_3/header.h
there was class called "Inner" as seen in exception message 
Comment 9 Jiri Prox 2007-03-30 11:08:28 UTC
Created attachment 40183 [details]
Header file
Comment 10 Jiri Prox 2007-03-30 11:11:51 UTC
Header file is attached
Comment 11 Vladimir Voskresensky 2007-03-30 13:54:38 UTC
Ok. I see the problem.
you don't have ";" in line:14 
int top //<= no trailing ; => parser didn't recover correctly
Comment 12 Vladimir Voskresensky 2007-03-30 13:57:16 UTC
the following incorrect code (no trailing ";" in declaration "int a") generates
funny class view
class A1 {
    int a
};
class A2 {
    int a
};
class A3 {
    int a
};
class A4 {
    int a
};
class A5 {
    int a
};
see attachment
Comment 13 Vladimir Voskresensky 2007-03-30 13:58:29 UTC
Created attachment 40189 [details]
class view for missed ";"
Comment 14 Vladimir Voskresensky 2007-03-30 13:58:48 UTC
Created attachment 40190 [details]
class view for missed ";"
Comment 15 Vladimir Voskresensky 2007-08-30 16:43:39 UTC
we fixed some recovering problems and now class view and completion handle this example correctly