2121
2222import com .sonar .sslr .api .AstNode ;
2323import com .sonar .sslr .api .GenericTokenType ;
24- import static com .sonar .sslr .api .GenericTokenType .IDENTIFIER ;
2524import com .sonar .sslr .api .Grammar ;
2625import com .sonar .sslr .api .Token ;
2726import com .sonar .sslr .impl .ast .AstXmlPrinter ;
2827import java .util .ArrayList ;
2928import java .util .List ;
29+ import java .util .stream .Collectors ;
3030import javax .annotation .CheckForNull ;
3131import org .sonar .api .utils .log .Logger ;
3232import org .sonar .api .utils .log .Loggers ;
3333import org .sonar .cxx .parser .CxxGrammarImpl ;
34- import static org .sonar .cxx .parser .CxxGrammarImpl .qualifiedId ;
3534import org .sonar .cxx .parser .CxxKeyword ;
3635import org .sonar .cxx .parser .CxxPunctuator ;
3736import org .sonar .cxx .squidbridge .checks .SquidCheck ;
@@ -646,13 +645,10 @@ private void visitTemplateDeclaration(AstNode templateDeclaration) {
646645 if (declId == null ) {
647646 return ;
648647 }
649- var idNode = declId .getLastChild (qualifiedId );
650- if (idNode != null ) {
651- idNode = idNode .getLastChild (IDENTIFIER );
652- } else {
653- idNode = declId ;
654- }
655- String id = idNode .getTokenValue ();
648+
649+ String id = declId .getTokens ().stream ()
650+ .map (Token ::getValue )
651+ .collect (Collectors .joining ());
656652
657653 // handle cascaded template declarations
658654 AstNode node = templateDeclaration ;
@@ -815,7 +811,7 @@ private void visitEnumSpecifier(AstNode enumSpecifierNode) {
815811 docNode = enumSpecifierNode ;
816812 }
817813
818- visitPublicApi (enumSpecifierNode , enumId ,getBlockDocumentation (docNode ));
814+ visitPublicApi (enumSpecifierNode , enumId , getBlockDocumentation (docNode ));
819815
820816 // deal with enumeration values
821817 AstNode enumeratorList = enumSpecifierNode .getFirstDescendant (CxxGrammarImpl .enumeratorList );
@@ -841,7 +837,7 @@ private void visitEnumSpecifier(AstNode enumSpecifierNode) {
841837 }
842838 }
843839
844- visitPublicApi (definition , definition .getFirstDescendant ( GenericTokenType .IDENTIFIER ).getTokenValue (), comments );
840+ visitPublicApi (definition , definition .getFirstDescendant (GenericTokenType .IDENTIFIER ).getTokenValue (), comments );
845841 }
846842 }
847843 }
0 commit comments