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 135167

Summary: Braces matching (MasterMatcher) doesn't work anymore for non-Lexer kits
Product: editor Reporter: emi <emi>
Component: NavigationAssignee: Vitezslav Stejskal <vstejskal>
Status: RESOLVED FIXED    
Severity: blocker Keywords: SIMPLEFIX
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description emi 2008-05-15 17:25:21 UTC
MasterMatcher.findFactories(...) compares TokenHierarchy.get(document) with null but TokenHierarchy.get(document) is
never null anymore (just look at the call chain, it will always return a valid object with the current codebase).

This breaks braces matching for non-Lexer kits as TokenHierarchy.get(document) returns non-null but 
th.embeddedTokenSequences(offset, backward).isEmpty()==true and thus no factory is returned.

The check should probably be:
     if (th.isActive()) {
         List<TokenSequence<?>> sequences = th.embeddedTokenSequences(offset, backward);
     ...

This seems to fix the bug, ie. braces matching works again for my editor. I'm not entirely certain it is correct, but
.isActive() seems to be used by org.netbeans.modules.editor.impl.highlighting.HLFactory to check for a lexer kit.
Comment 1 Vitezslav Stejskal 2008-05-19 10:19:40 UTC
I see, I'll fix it. I think your fix is correct. IIRC the lexer behavior was changed some time ago and we went through
the codebase and changed it. This must have slipped through somehow, sorry.
Comment 2 Vitezslav Stejskal 2008-06-07 10:01:39 UTC
http://hg.netbeans.org/main/rev/8fa62a739a0a
Comment 3 Quality Engineering 2008-06-07 16:10:26 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #243 build
Changeset: http://hg.netbeans.org/main/rev/8fa62a739a0a
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #135167 (fixed): proper check for lexerified languages