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 243262 - regression: template specializations parsed incorrectly
Summary: regression: template specializations parsed incorrectly
Status: REOPENED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.0.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: petrk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-25 15:00 UTC by tbrunhoff
Modified: 2014-11-19 18:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
sample project. (6.52 KB, application/x-compressed-tar)
2014-03-25 15:00 UTC, tbrunhoff
Details
shot of ide errors (93.66 KB, image/jpeg)
2014-03-25 15:01 UTC, tbrunhoff
Details
snapshot of original errors. (52.87 KB, image/png)
2014-04-19 16:52 UTC, tbrunhoff
Details
two projects that demonstrate the problem (11.75 KB, application/x-compressed-tar)
2014-04-24 17:23 UTC, tbrunhoff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tbrunhoff 2014-03-25 15:00:43 UTC
Created attachment 146310 [details]
sample project.

Bugs #190668, #155054, #100325 and #92138 are complaints about template specializations that are highlighted as errors in the ide.  All are marked fixed, so perhaps this is a regression.

Attached is a small, complete project that compiles correctly, but the ide shows errors on the template specializations in tools.cc. Attached also is a screen shot of the editor. Interestingly, when I remove the template insantiations using the enum and the enum declarations, some unrelated errors in other specializations disappear.

Product Version: NetBeans IDE Dev (Build 201403100001)
Updates: Updates available
Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Linux version 3.12.6-200.fc19.x86_64 running on i386; UTF-8; en_US (nb)
User directory: /home/toddb/.netbeans/dev
Cache directory: /home/toddb/.cache/netbeans/dev
Comment 1 tbrunhoff 2014-03-25 15:01:36 UTC
Created attachment 146311 [details]
shot of ide errors
Comment 2 petrk 2014-04-18 11:53:14 UTC
Seems that it is already fixed in dev version.
Comment 3 tbrunhoff 2014-04-19 16:50:35 UTC
Please look a little more closely. The declaration of NodeOption ctor in header.h has an error. Note also that this sample project is a distillation of a much larger project.  The original errors I see (re new attached screenshot) hit each of the parse() method name and the mName and mValue usages.
Comment 4 tbrunhoff 2014-04-19 16:52:21 UTC
Created attachment 146843 [details]
snapshot of original errors.
Comment 5 tbrunhoff 2014-04-19 16:56:10 UTC
I should note that you are partly correct: The current version, netbeans-trunk-nightly-201404190001-cpp-linux.sh, has fewer errors.
Comment 6 petrk 2014-04-19 17:06:05 UTC
Hmm in my ide there were no errors. What happens after reparsing of the project?
Comment 7 petrk 2014-04-19 17:11:57 UTC
Actually, you are absolutely right, there is a problem after opening the project again. Interesting thing is that in fact all highlighted errors are resolved - you can navigate at them. After reparsing and closing/opening file, there are no red highlighting.
Comment 8 tbrunhoff 2014-04-19 23:23:56 UTC
Well, I have long used the three-step process to convince NB to do the right thing: (a) clean and build, (b) configure project using build output, (c) reparse project. This does work in most cases, although I would hope you would agree that it is a bug that that process is require.  But that's a different subject. In this case the process does not work, and my code is nicely decorated with red spots, as illustrated in the last attached screenshot.

Presumably you are a very smart guy because you got assigned this bug. So the question is: can you figure out what is broken?

I should note that there are a few differences between the demo project and my collection of projects. First is that the project properties for bug4 does not have a 'Configure Code Assistance' menu item. My project (which contains the code with the errors) does have a 'Configure Code Assistance' menu item, and under the properties dialog there is a configure code assistance item where I have unchecked 'Use Build analyzer'.  The reason for this is that I have 40 separate projects, one for each library, and if I use the build analyzer, it (wrongly) begins to add duplicate directories to all the projects after each build.

So... we could talk about the 2 million lines of code that I maintain with netbeans...

There is something else I just thought of that could be a hint. In my project, as shown, the parse method, the mName and mValue members are all underlined in red and the flyover says that they do not have a definition. But I can actually use Navigate-->go to declaration on 'parse', but not on the member variables. So clearly there is some confusion in the code.

What logs or analysis can I send you that will reveal the problem?
Comment 9 petrk 2014-04-22 11:50:46 UTC
Of cause, this is a bug, and I will not close it, don't worry:). Thanks for assistance, but since I could reproduce it on your sample project, I don't think that I need to see any logs or know details of configuration of your real project right now.
Comment 10 Quality Engineering 2014-04-24 02:10:51 UTC
Integrated into 'main-silver', will be available in build *201404240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/a972b5360b0a
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixing #243262 - regression: template specializations parsed incorrectly
Comment 11 tbrunhoff 2014-04-24 16:15:08 UTC
I needed to remove ~/.cache/netbeans/dev/cnd/model (as usual for version changes) but this patch fixed a long-time problem! Very nice.
Comment 12 tbrunhoff 2014-04-24 16:43:04 UTC
I spoke too soon. The sample project appears to be fine now, but my code still displays with errors. Here's the order of events:
- I removed ~/.cache/netbeans/dev/cnd/model
- started the ide, allowed projects to be parsed
- looked at the code and all the errors marked in the ide were gone. But...
- I noticed it could not resolve any of the symbols; e.g. click on 'parse' in NodeOptionT<uint>::parse(const char* value) and click 'go to declaration' which failed.
- again, I exited the ide, removed ~/.cache/netbeans/dev/cnd/model
- started the ide, allowed projects to be parsed
- clean & build, configure project using build output, reparse project.
- the errors returned as illustrated in the 'snapshot of original errors' attachment, but all of the symbols except for mValue can be navigated.

Any ideas what could be different? The structure of the project? The use of multiple projects? Some kind of disconnect between the navigable state of variables and the ide's ability to resolve variables?
Comment 13 tbrunhoff 2014-04-24 16:52:25 UTC
I've always noticed that NB has trouble with multiple projects.  What about this: let's say that there are two projects A and B. Project A is a library, just like the attached demo project, and project B is an application that links with project A. So if I were to open tools.cc in the editor, could it be that the navigation of variables is handled by the (correct) state of project A, but the editor's display of variables is handled by the (incorrect) state of project B?
Comment 14 tbrunhoff 2014-04-24 17:23:57 UTC
Created attachment 146926 [details]
two projects that demonstrate the problem

Well, I think the new attachment demonstrates the problem. Two projects: a library and an app. This is very similar to the way I have constructed the netbeans projects on top of existing code. tools.cc in bug5a now shows the ide errors but the member variables are still navigable.
Comment 15 petrk 2014-04-28 15:13:02 UTC
Thank you for test case again, and, yes, the problem could be if you have move than one opened project. I've pushed some more changes and the second test case works normally now, so, please, check the next dev version (will be available tomorrow) on your main project.

BTW, don't forget to remove cachedir :)
Comment 16 petrk 2014-04-28 15:19:13 UTC
Another small note - the problem is not in multiple opened projects, it is in way we handling specializations in instantiated classes. Opening a couple of projects just changes the parse queue (I suppose), so the problem appears.
Comment 17 Quality Engineering 2014-04-29 02:25:45 UTC
Integrated into 'main-silver', will be available in build *201404290001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6e576da6a38d
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Additional fix for #243262 - regression: template specializations parsed incorrectly
Comment 18 tbrunhoff 2014-04-29 17:43:35 UTC
Not sure what you are looking at but using the build below (and, yes, removing the cache) the last sample pair of projects now shows a parse error on stl string and I can't navigate to the string declaration.

And in my projects, it is just as bad as ever: I can navigate the methods but not the members, and the ide is still sprinkled with red markers.

I am going to bet that you see something different... a different error or a different location for the error, or something. Which suggests that this is more driven by the state of the state machine in the ide. Perhaps the parse queue as you suggested or something more nefarious.


Product Version: NetBeans IDE Dev (Build 201404290001)
Java: 1.7.0_51; Java HotSpot(TM) Client VM 24.51-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_51-b13
System: Linux version 3.12.11-201.fc19.x86_64 running on i386; UTF-8; en_US (nb)
User directory: /home/toddb/.netbeans/dev
Cache directory: /home/toddb/.cache/netbeans/dev
Comment 19 Quality Engineering 2014-04-30 02:15:15 UTC
Integrated into 'main-silver', will be available in build *201404300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/3ae719cda496
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Additional fix for #243262 - regression: template specializations parsed incorrectly
Comment 20 petrk 2014-04-30 09:28:45 UTC
Maybe not all changes were in build 201404290001? Please, check both samples in 201404300001 and if there would be any errors, describe each step you make (I suggest you to try samples with not only clean cachedir but clean userdir as well (you can use --userdir <path> command line parameter)).
Comment 21 tbrunhoff 2014-04-30 15:26:42 UTC
Briefly: this build201404300001 fixes the ide errors and all the members and methods are navigable. However, the similar code in my projects still has the ide errors on the 'parse' method name and 'mValue' member variables. 'parse' is navigable and mValue is not.

1. mv ~/.cache/netbeans/dev aside
2. start netbeans --userdir ~/tmp/.netbeans
3. load/build bug5a and bug5b projects; all c++ files show without errors
4. load/build my projects; NodeOptionT<>::parse() and NodeOptionT<>::mValue are underlined in red. I can navigate parse() back to the declaration, but not mValue.
5. restart netbeans without --userdir
6. repeat 3 & 4 with the same results.

So.... how can I capture the state of the ide that can reveal the problem? I'd give you the code, but it is proprietary.
Comment 22 petrk 2014-05-06 14:32:20 UTC
For now log is not very useful, so I will add more logging to reveal this problem, but a little bit later.
Comment 23 Quality Engineering 2014-06-04 15:26:01 UTC
Integrated into 'releases/release80', will be available in build *201406041415* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/6f5dd03943f0
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixing #243262 - regression: template specializations parsed incorrectly
(transplanted from a972b5360b0af1bf5b18772b7bcb9a9174aa8b96)