private static String parseMethodViaDescription( final String desc, final PsiMethodStubImpl stub, final List<String> args) { final String returnType = getTypeText(Type.getReturnType(desc)); final Type[] argTypes = Type.getArgumentTypes(desc); for (Type argType : argTypes) { args.add(getTypeText(argType)); } new PsiTypeParameterListStubImpl(stub); return returnType; }
@NotNull private static TypeInfo fieldTypeViaDescription(@NotNull String desc) { Type type = Type.getType(desc); final int dim = type.getSort() == Type.ARRAY ? type.getDimensions() : 0; if (dim > 0) { type = type.getElementType(); } return new TypeInfo( getTypeText(type), (byte) dim, false, Collections.<PsiAnnotationStub>emptyList()); // todo read annos from .class file }
public AnnotationTextCollector(@Nullable String desc, AnnotationResultCallback callback) { super(Opcodes.ASM4); myCallback = callback; myDesc = desc; if (desc != null) { myBuilder.append('@').append(getTypeText(Type.getType(desc))); } }
@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; }
private static String getClassName(final String name) { return getTypeText(Type.getObjectType(name)); }
@Override public void visitEnum(final String name, final String desc, final String value) { valuePairPrefix(name); myBuilder.append(getTypeText(Type.getType(desc))).append(".").append(value); }