@SuppressWarnings({"HardCodedStringLiteral"}) private static JVMName getJVMSignature( @Nullable PsiMethod method, boolean constructor, @Nullable PsiClass declaringClass) { JVMNameBuffer signature = new JVMNameBuffer(); signature.append("("); if (constructor) { if (declaringClass != null) { final PsiClass outerClass = declaringClass.getContainingClass(); if (outerClass != null) { // declaring class is an inner class if (!declaringClass.hasModifierProperty(PsiModifier.STATIC)) { appendJvmClassQualifiedName(signature, getJVMQualifiedName(outerClass)); } } } } if (method != null) { for (PsiParameter psiParameter : method.getParameterList().getParameters()) { appendJVMSignature(signature, psiParameter.getType()); } } signature.append(")"); if (!constructor && method != null) { appendJVMSignature(signature, method.getReturnType()); } else { signature.append(new JVMRawText("V")); } return signature.toName(); }
@SuppressWarnings({"HardCodedStringLiteral"}) private static void appendJVMSignature(JVMNameBuffer buffer, PsiType type) { if (type == null) { return; } final PsiType psiType = TypeConversionUtil.erasure(type); if (psiType instanceof PsiArrayType) { buffer.append(new JVMRawText("[")); appendJVMSignature(buffer, ((PsiArrayType) psiType).getComponentType()); } else if (psiType instanceof PsiClassType) { final JVMName jvmName = getJVMQualifiedName(psiType); appendJvmClassQualifiedName(buffer, jvmName); } else if (psiType instanceof PsiPrimitiveType) { buffer.append(getPrimitiveSignature(psiType.getCanonicalText())); } else { LOG.error("unknown type " + type.getCanonicalText()); } }