String (@NotNull GrReferenceElement element) { final String referenceName = element.getReferenceName(); if (referenceName == null) return null; // Foo -> java.util.List final String mappedFqn = getAliasMapping(element.getContainingFile()).get(referenceName); final String fullText = element.getText(); // alias: Foo<String> -> java.util.List<String> // unqualified ref: List<String> -> List<String> // qualified ref: java.util.List<String> -> java.util.List<String> return mappedFqn == null || element.isQualified() ? fullText : fullText.replace(referenceName, mappedFqn); }