String (@NotNull GrNamedElement namedElement) { PsiElement nameElement = namedElement.getNameIdentifierGroovy(); ASTNode node = nameElement.getNode(); LOG.assertTrue(node != null); if (node.getElementType() == GroovyTokenTypes.mIDENT || TokenSets.CODE_REFERENCE_ELEMENT_NAME_TOKENS.contains(node.getElementType())) { return nameElement.getText(); } if (GroovyTokenSets.STRING_LITERALS.contains(node.getElementType())) { final Object value = GrLiteralImpl.getLiteralValue(nameElement); if (value instanceof String) { return (String)value; } else { return GrStringUtil.removeQuotes(nameElement.getText()); } } throw new IncorrectOperationException("incorrect name element: " + node.getElementType() + ", named element: " + namedElement); }