public static String getSignature()

in src/main/java/org/apache/bcel/classfile/Utility.java [768:818]


    public static String getSignature(String type) {
        final StringBuilder buf = new StringBuilder();
        final char[] chars = type.toCharArray();
        boolean charFound = false;
        boolean delim = false;
        int index = -1;
        loop: for (int i = 0; i < chars.length; i++) {
            switch (chars[i]) {
            case ' ':
            case '\t':
            case '\n':
            case '\r':
            case '\f':
                if (charFound) {
                    delim = true;
                }
                break;
            case '[':
                if (!charFound) {
                    throw new IllegalArgumentException("Illegal type: " + type);
                }
                index = i;
                break loop;
            default:
                charFound = true;
                if (!delim) {
                    buf.append(chars[i]);
                }
            }
        }
        int brackets = 0;
        if (index > 0) {
            brackets = countBrackets(type.substring(index));
        }
        type = buf.toString();
        buf.setLength(0);
        for (int i = 0; i < brackets; i++) {
            buf.append('[');
        }
        boolean found = false;
        for (int i = Const.T_BOOLEAN; i <= Const.T_VOID && !found; i++) {
            if (Const.getTypeName(i).equals(type)) {
                found = true;
                buf.append(Const.getShortTypeName(i));
            }
        }
        if (!found) {
            buf.append('L').append(packageToPath(type)).append(';');
        }
        return buf.toString();
    }