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 270271

Summary: StackOverflowError at org.netbeans.modules.cnd.repository.RepositoryImpl.get
Product: cnd Reporter: chila
Component: Code ModelAssignee: Vladimir Kvashin <vkvashin>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 228627
Attachments: stacktrace

Description chila 2017-04-01 13:34:25 UTC
This bug was originally marked as duplicate of bug 256516, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 8.2 (Build 201609300101)
VM: OpenJDK 64-Bit Server VM, 25.121-b13, OpenJDK Runtime Environment, 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13
OS: Linux

User Comments:
chila: It happened when I was parsing my project.




Stacktrace: 
java.lang.StackOverflowError
   at org.netbeans.modules.cnd.repository.RepositoryImpl.get(RepositoryImpl.java:146)
   at org.netbeans.modules.cnd.repository.api.Repository.get(Repository.java:66)
   at org.netbeans.modules.cnd.modelimpl.repository.RepositoryUtils.get(RepositoryUtils.java:123)
   at org.netbeans.modules.cnd.modelimpl.repository.RepositoryUtils.get(RepositoryUtils.java:104)
   at org.netbeans.modules.cnd.modelimpl.uid.UIDUtilities$CachedUID.getObject(UIDUtilities.java:494)
   at org.netbeans.modules.cnd.modelimpl.uid.UIDCsmConverter.UIDtoCsmObject(UIDCsmConverter.java:111)
Comment 1 chila 2017-04-01 13:34:28 UTC
Created attachment 163999 [details]
stacktrace
Comment 2 Vladimir Kvashin 2017-04-10 14:49:12 UTC
I was not able to reproduce this. However while investigating I understood the following problem. Consider the code
  #define M namespace ns2 { namespace ns2 { struct Base {int f;}; } }
  M
Navigator shows only one namespace - ns2 and class Base, according to navigator, belongs to this 1-st level namespace. If you write the same without macro
  namespace ns2 { namespace ns2 { struct Base {int f;}; } }
then navigator shows ns2 with nested ns2 and class Base inside the nested one.

Investigation shows that keys are equal for outer and inner ns namespaces.
There was a similar bug concerning classes - issue #256516 (tackOverflowError at org.netbeans.modules.cnd.repository.RepositoryImpl.get).

Unfortunately I wasn't able to solve this one as the issue #256516 was solved. That's because NameSpaceImpl.getScope() returns getContainingFile(), so currently it is not possible to get physical container for a namespace definition.

All ways of fixing this that come to my mind are too risky for this patch.