@NotNull
  @Override
  public TextRange getDeclarationRange(@NotNull GrTypeDefinition aClass) {
    if (aClass instanceof GrAnonymousClassDefinition){
      GrNewExpression call = (GrNewExpression)aClass.getParent();
      int startOffset = call.getTextRange().getStartOffset();
      int endOffset = call.getArgumentList().getTextRange().getEndOffset();
      return new TextRange(startOffset, endOffset);
    }
    else{
      final PsiModifierList modifierList = aClass.getModifierList();
      int startOffset = modifierList == null ? aClass.getTextRange().getStartOffset() : modifierList.getTextRange().getStartOffset();
      final GrImplementsClause implementsList = aClass.getImplementsClause();
      int endOffset = implementsList == null ? aClass.getTextRange().getEndOffset() : implementsList.getTextRange().getEndOffset();
      return new TextRange(startOffset, endOffset);
    }

  }
@NotNull
  @Override
  public TextRange getDeclarationRange(@NotNull GrTypeDefinition aClass)