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.
Both the hyperlinking and code completion access the document (directly or indirectly through XMLSyntaxSupport) without locking, or they assume that once computed data (tokens, elements from the XML element chain, etc.) will be present in the document at a point in point subsequent to their creation. This assumption is wrong, since the document may have changed. For code completion, the simplest fix seems to be to create a copy of the document and use it for a whole single invocation of the code completion. For hyperlinking, creating a copy of the document may impact performance, so the fix could be to compute everything that is needed to perform the hyperlinking in advance. Especially the hyperlinking should not put XML chain elements and/or tokens in HyperlinkEnv. A related problem in hyperlinking might be that the current implementation makes illegal assumptions about the calling order of HyperlinkProvider methods. The calling order of these methods is not guaranteed.
This appears to be a possible design issue. Is there a use case or set of reproducible steps that exposes this race condition?\ If no, then if it's a design issue then shouldn't this be an enhancement?
> Is there a use case or set of reproducible steps that exposes this race condition?\ Not reliably, but both I and Rohan have encountered random exceptions that could have been caused by this. > If no, then if it's a design issue then shouldn't this be an enhancement? No because of the above and because I consider the current design simply too risky. Also, my experience is that once an issue is marked as an enhancement, nobody cares about it in the next release.
Changes done for code completion in changeset 7ea8199d06d8 and 53c7bd59d19c
*** Issue 128860 has been marked as a duplicate of this issue. ***
*** Issue 129024 has been marked as a duplicate of this issue. ***
Changes done for hyperlinking in changeset 1f36276b6056, 4bb44156f3a3, 4e8723fd0868.