/**
  * There is a possible case that 'implements' section is incomplete (e.g. ends with comma). We may
  * want to align lbrace to the comma then.
  *
  * @param alignment block alignment
  * @param baseNode base AST node
  * @return alignment strategy to use for the given node
  */
 private static AlignmentStrategy getAlignmentStrategy(
     Alignment alignment, ASTNode baseNode, @NotNull CommonCodeStyleSettings settings) {
   if (baseNode.getElementType() != JavaElementType.CLASS
       || !settings.ALIGN_MULTILINE_EXTENDS_LIST) {
     return AlignmentStrategy.wrap(alignment);
   }
   for (ASTNode node = baseNode.getLastChildNode();
       node != null;
       node = FormatterUtil.getPreviousNonWhitespaceSibling(node)) {
     if (node.getElementType() != JavaElementType.IMPLEMENTS_LIST) {
       continue;
     }
     ASTNode lastChildNode = node.getLastChildNode();
     if (lastChildNode != null && lastChildNode.getElementType() == TokenType.ERROR_ELEMENT) {
       Alignment alignmentToUse = alignment;
       if (alignment == null) {
         alignmentToUse = Alignment.createAlignment();
       }
       return AlignmentStrategy.wrap(
           alignmentToUse,
           false,
           JavaTokenType.LBRACE,
           JavaElementType.JAVA_CODE_REFERENCE,
           node.getElementType());
     }
     break;
   }
   return AlignmentStrategy.wrap(alignment);
 }