@NotNull private static String getTypeText(@NotNull Type type) { final String raw = type.getClassName(); // As the '$' char is a valid java identifier and is actively used by byte code generators, the // problem is // which occurrences of this char should be replaced and which should not. // Heuristic: replace only those $ occurrences that are surrounded non-"$" chars // (most likely generated by javac to separate inner or anonymous class name) // Leading and trailing $ chars should be left unchanged. return raw.indexOf('$') >= 0 ? REGEX_PATTERN.matcher(raw).replaceAll("\\.") : raw; }