Converts from signature to slashed class name
(e.g., from Ljava/lang/String; to java/lang/String).
Returns null if it is the signature for an array or
primitive type.
322913
public static @CheckForNull
    @SlashedClassName
    String fromFieldSignature(String signature) {
        if (signature.charAt(0) != 'L') {
            return null;
        }
        return signature.substring(1, signature.length() - 1);
    }
682143
static private String findParamFor(String s)
	{
		int endClassIndex = s.indexOf('[');
		if (endClassIndex<0) return null;
		else {
			int endParamIndex = s.indexOf('=',endClassIndex+1);
			if (endParamIndex<0) throw new IllegalStateException("illegal class description '"+s+"'");
			return s.substring(endClassIndex+1,endParamIndex);
		}
	}
562793
private String getComponentType(String componentType) throws SignatureException {

        String JVMSig = "";

        if(componentType != null){
            switch (componentType) {
                case "void":    JVMSig += SIG_VOID;    break;
                case "boolean": JVMSig += SIG_BOOLEAN; break;
                case "byte":    JVMSig += SIG_BYTE;    break;
                case "char":    JVMSig += SIG_CHAR;    break;
                case "short":   JVMSig += SIG_SHORT;   break;
                case "int":     JVMSig += SIG_INT;     break;
                case "long":    JVMSig += SIG_LONG;    break;
                case "float":   JVMSig += SIG_FLOAT;   break;
                case "double":  JVMSig += SIG_DOUBLE;  break;
                default:
                    if (!componentType.equals("")) {
                        TypeElement classNameDoc = elems.getTypeElement(componentType);

                        if (classNameDoc == null) {
                            throw new SignatureException(componentType);
                        }
                        else {
                            String classname = classNameDoc.getQualifiedName().toString();
                            String newclassname = classname.replace('.', '/');
                            JVMSig += "L";
                            JVMSig += newclassname;
                            JVMSig += ";";
                        }
                    }
                    break;
            }
        }
        return JVMSig;
    }
502235
function parse(signature) {
		var pattern = /^(?:void|([a-zA-Z]+!?|\.{3})(?:[:\s]+([a-zA-Z]+)(?:(=)(@)?(.*))?)?)?$/;

		return signature.split(/\s*,\s*/).map(function(argument, index, all) {
			var result = prepareArgument(argument.match(pattern), 'var' + (index + 1));

			if (result.type === false) {
				throw new Error('polymorphic: invalid argument "' + argument + '" in signature "' + signature + '"');
			}
			else if (result.type === '...' && index < all.length - 1) {
				throw new Error('polymorphic: variadic argument must be at end of signature "' + signature + '"');
			}

			return result;
		}).filter(function(argument) {
			//  a type is undefined if it was declared as 'void' or '' (an empty string)
			return argument.type !== undefined;
		});
	}
78695
private static String getClassFromLine(String line) {
        line = line.trim();

        // Skip commented lines
        if (line.length() == 0 || line.startsWith("#"))
            return null;

        // lop off spaces/tabs/end-of-line-comments
        String[] className = line.split("[\\s#]");

        if (className.length >= 1)
            return className[0];

        return null;
    }
858030
static String getClassSignature(String[] interfaces, String className, String apiName) {
        StringBuilder signature;

        signature = new StringBuilder("<Z::" + XsdSupportingStructure.elementTypeDesc + ">" + JAVA_OBJECT_DESC);

        if (interfaces != null){
            for (String anInterface : interfaces) {
                signature.append("L")
                        .append(getFullClassTypeName(anInterface, apiName))
                        .append("<L")
                        .append(getFullClassTypeName(className, apiName))
                        .append("<TZ;>;TZ;>;");
            }
        }

        return signature.toString();
    }
283866
public String signature() {
        if (typeParameters.isEmpty()) {
            return name;
        } else {
            return name + '<' + Joiner.on(", ").join(typeParameters) + '>';
        }
    }
438096
public static String getSignature(CtBehavior method) throws NotFoundException {

        CtClass[] parameterTypes = method.getParameterTypes();

        CodeAttribute codeAttribute = method.getMethodInfo().getCodeAttribute();

        LocalVariableAttribute locals = null;

        if (codeAttribute != null) {
            AttributeInfo attribute;
            attribute = codeAttribute.getAttribute("LocalVariableTable");
            locals = (LocalVariableAttribute) attribute;
        }

        String methodName = method.getName();

        StringBuilder sb = new StringBuilder(methodName).append("(\" ");
        for (int i = 0; i < parameterTypes.length; i++) {
            if (i > 0) {
                // add a comma and a space between printed values
                sb.append(" + \", \" ");
            }

            CtClass parameterType = parameterTypes[i];
            boolean isArray = parameterType.isArray();
            CtClass arrayType = parameterType.getComponentType();
            if (isArray) {
                while (arrayType.isArray()) {
                    arrayType = arrayType.getComponentType();
                }
            }

            sb.append(" + \"");
            try {
                sb.append(parameterNameFor(method, locals, i));
            } catch (Exception e) {
                sb.append(i + 1);
            }
            sb.append("\" + \"=");

            if (parameterType.isPrimitive()) {
                // let the compiler handle primitive -> string
                sb.append("\"+ $").append(i + 1);
            } else {
                String s = "org.slf4j.instrumentation.ToStringHelper.render";
                sb.append("\"+ ").append(s).append("($").append(i + 1).append(')');
            }
        }
        sb.append("+\")");

        String signature = sb.toString();
        return signature;
    }
1261363
static String getInterfaceSignature(String[] interfaces, String apiName) {
        StringBuilder signature = new StringBuilder("<T::L" + XsdSupportingStructure.elementType + "<TT;TZ;>;Z::" + XsdSupportingStructure.elementTypeDesc + ">" + JAVA_OBJECT_DESC);

        if (interfaces != null){
            for (String anInterface : interfaces) {
                signature.append("L")
                        .append(getFullClassTypeName(anInterface, apiName))
                        .append("<TT;TZ;>;");
            }
        }

        return signature.toString();
    }
756877
private FullTypeSignature getTypeSignature(Class<?> clazz) {
		StringBuilder sb = new StringBuilder();
		if (clazz.isArray()) {
			sb.append(clazz.getName());
		} else if (clazz.isPrimitive()) {
			sb.append(primitiveTypesMap.get(clazz).toString());
		} else {
			sb.append('L').append(clazz.getName()).append(';');
		}
		return TypeSignatureFactory.getTypeSignature(sb.toString(), false);

	}
1074941
public static function toClassname($string)
    {
        if (empty($string)) {
            return null;
        }

        $classnameMatches = [];
        if (preg_match('/^([a-zA-Z_]{1}[a-zA-Z0-9_\\\\]*)\::class$/', $string, $classnameMatches) != false) {
            if (class_exists($classnameMatches[1])) {
                return $classnameMatches[1];
            }
        }

        return null;
    }
987309
function _stringToSignature(string_signatures) {
	const signatures = [];
	for (let signature of string_signatures) {
		// check for properties rather than object type
		if (signature && signature.signature_header && signature.signature) {
			logger.debug('_stringToSignature - signature is protobuf');
		} else {
			logger.debug('_stringToSignature - signature is string');
			const signature_bytes = Buffer.from(signature, 'hex');
			signature = _configtxProto.ConfigSignature.decode(signature_bytes);
		}
		signatures.push(signature);
	}

	return signatures;
}
39661
@Nullable
  public static <DATATYPE> Class <DATATYPE> getClassFromNameSafe (@Nonnull final String sName)
  {
    try
    {
      return getClassFromName (sName);
    }
    catch (final ClassNotFoundException e)
    {
      return null;
    }
  }
940422
private static boolean isJDBCClass(@SlashedClassName String name) {
        String clsName = SignatureUtils.stripSignature(name);

        return (clsName.startsWith("java.sql.") || clsName.startsWith("javax.sql.")) && !clsName.endsWith("Exception");
    }
1279134
private static String getShortTypeName(Class < ? > javaType) {
        String javaTypeName = javaType.getName();
        if (javaTypeName.startsWith("java.lang.")) {
            return javaTypeName.substring("java.lang.".length());
        } else {
            return javaTypeName;
        }
    }
953841
public static String convertUnderscoreNameToClassName(String name) {
        StringBuffer result = new StringBuffer();
        boolean nextIsUpper = false;

        if (name != null) {
            int len = name.length();

            if (len > 0) {
                String s = String.valueOf(name.charAt(0));

                result.append(s.toUpperCase());

                for (int i = 1; i < len; i++) {
                    s = String.valueOf(name.charAt(i));

                    if ("_".equals(s)) {
                        nextIsUpper = true;
                    } else {
                        if (nextIsUpper) {
                            result.append(s.toUpperCase());
                            nextIsUpper = false;
                        } else {
                            result.append(s.toLowerCase());
                        }
                    }
                }
            }
        }

        return result.toString();
    }
1125850
private FullTypeSignature getFullTypeSignature(Type type) {
		if (type instanceof Class<?>) {
			return getTypeSignature((Class<?>) type);
		}
		if (type instanceof GenericArrayType) {
			return getArrayTypeSignature((GenericArrayType) type);
		}
		if (type instanceof ParameterizedType) {
			return getClassTypeSignature((ParameterizedType) type);
		}
		return null;
	}