Java Code Examples for jdk.internal.org.objectweb.asm.Type#getDimensions()

The following examples show how to use jdk.internal.org.objectweb.asm.Type#getDimensions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Remapper.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public String mapDesc(String desc) {
    Type t = Type.getType(desc);
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return s;
    case Type.OBJECT:
        String newType = map(t.getInternalName());
        if (newType != null) {
            return 'L' + newType + ';';
        }
    }
    return desc;
}
 
Example 2
Source File: Remapper.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public String mapDesc(String desc) {
    Type t = Type.getType(desc);
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return s;
    case Type.OBJECT:
        String newType = map(t.getInternalName());
        if (newType != null) {
            return 'L' + newType + ';';
        }
    }
    return desc;
}
 
Example 3
Source File: Remapper.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public String mapDesc(String desc) {
    Type t = Type.getType(desc);
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return s;
    case Type.OBJECT:
        String newType = map(t.getInternalName());
        if (newType != null) {
            return 'L' + newType + ';';
        }
    }
    return desc;
}
 
Example 4
Source File: Remapper.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public String mapDesc(String desc) {
    Type t = Type.getType(desc);
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return s;
    case Type.OBJECT:
        String newType = map(t.getInternalName());
        if (newType != null) {
            return 'L' + newType + ';';
        }
    }
    return desc;
}
 
Example 5
Source File: Remapper.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private Type mapType(Type t) {
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return Type.getType(s);
    case Type.OBJECT:
        s = map(t.getInternalName());
        return s != null ? Type.getObjectType(s) : t;
    case Type.METHOD:
        return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
    }
    return t;
}
 
Example 6
Source File: Remapper.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private Type mapType(Type t) {
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return Type.getType(s);
    case Type.OBJECT:
        s = map(t.getInternalName());
        return s != null ? Type.getObjectType(s) : t;
    case Type.METHOD:
        return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
    }
    return t;
}
 
Example 7
Source File: Remapper.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public String mapDesc(String desc) {
    Type t = Type.getType(desc);
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return s;
    case Type.OBJECT:
        String newType = map(t.getInternalName());
        if (newType != null) {
            return 'L' + newType + ';';
        }
    }
    return desc;
}
 
Example 8
Source File: Remapper.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private Type mapType(Type t) {
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return Type.getType(s);
    case Type.OBJECT:
        s = map(t.getInternalName());
        return s != null ? Type.getObjectType(s) : t;
    case Type.METHOD:
        return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
    }
    return t;
}
 
Example 9
Source File: Remapper.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private Type mapType(Type t) {
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return Type.getType(s);
    case Type.OBJECT:
        s = map(t.getInternalName());
        return s != null ? Type.getObjectType(s) : t;
    case Type.METHOD:
        return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
    }
    return t;
}
 
Example 10
Source File: Remapper.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
  * Returns the given {@link Type}, remapped with {@link #map(String)} or {@link
  * #mapMethodDesc(String)}.
  *
  * @param type a type, which can be a method type.
  * @return the given type, with its [array element type] internal name remapped with {@link
  *     #map(String)} (if the type is an array or object type, otherwise the type is returned as
  *     is) or, of the type is a method type, with its descriptor remapped with {@link
  *     #mapMethodDesc(String)}.
  */
private Type mapType(final Type type) {
    switch (type.getSort()) {
        case Type.ARRAY:
            StringBuilder remappedDescriptor = new StringBuilder();
            for (int i = 0; i < type.getDimensions(); ++i) {
                remappedDescriptor.append('[');
            }
            remappedDescriptor.append(mapType(type.getElementType()).getDescriptor());
            return Type.getType(remappedDescriptor.toString());
        case Type.OBJECT:
            String remappedInternalName = map(type.getInternalName());
            return remappedInternalName != null ? Type.getObjectType(remappedInternalName) : type;
        case Type.METHOD:
            return Type.getMethodType(mapMethodDesc(type.getDescriptor()));
        default:
            return type;
    }
}
 
Example 11
Source File: Remapper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private Type mapType(Type t) {
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return Type.getType(s);
    case Type.OBJECT:
        s = map(t.getInternalName());
        return s != null ? Type.getObjectType(s) : t;
    case Type.METHOD:
        return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
    }
    return t;
}
 
Example 12
Source File: Remapper.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private Type mapType(Type t) {
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return Type.getType(s);
    case Type.OBJECT:
        s = map(t.getInternalName());
        return s != null ? Type.getObjectType(s) : t;
    case Type.METHOD:
        return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
    }
    return t;
}
 
Example 13
Source File: SimpleVerifier.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }

    boolean isArray = type.getSort() == Type.ARRAY;
    if (isArray) {
        switch (type.getElementType().getSort()) {
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
            return new BasicValue(type);
        }
    }

    BasicValue v = super.newValue(type);
    if (BasicValue.REFERENCE_VALUE.equals(v)) {
        if (isArray) {
            v = newValue(type.getElementType());
            String desc = v.getType().getDescriptor();
            for (int i = 0; i < type.getDimensions(); ++i) {
                desc = '[' + desc;
            }
            v = new BasicValue(Type.getType(desc));
        } else {
            v = new BasicValue(type);
        }
    }
    return v;
}
 
Example 14
Source File: SimpleVerifier.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }

    boolean isArray = type.getSort() == Type.ARRAY;
    if (isArray) {
        switch (type.getElementType().getSort()) {
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
            return new BasicValue(type);
        }
    }

    BasicValue v = super.newValue(type);
    if (BasicValue.REFERENCE_VALUE.equals(v)) {
        if (isArray) {
            v = newValue(type.getElementType());
            String desc = v.getType().getDescriptor();
            for (int i = 0; i < type.getDimensions(); ++i) {
                desc = '[' + desc;
            }
            v = new BasicValue(Type.getType(desc));
        } else {
            v = new BasicValue(type);
        }
    }
    return v;
}
 
Example 15
Source File: SimpleVerifier.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }

    boolean isArray = type.getSort() == Type.ARRAY;
    if (isArray) {
        switch (type.getElementType().getSort()) {
            case Type.BOOLEAN:
            case Type.CHAR:
            case Type.BYTE:
            case Type.SHORT:
                return new BasicValue(type);
            default:
                break;
        }
    }

    BasicValue value = super.newValue(type);
    if (BasicValue.REFERENCE_VALUE.equals(value)) {
        if (isArray) {
            value = newValue(type.getElementType());
            StringBuilder descriptor = new StringBuilder();
            for (int i = 0; i < type.getDimensions(); ++i) {
                descriptor.append('[');
            }
            descriptor.append(value.getType().getDescriptor());
            value = new BasicValue(Type.getType(descriptor.toString()));
        } else {
            value = new BasicValue(type);
        }
    }
    return value;
}
 
Example 16
Source File: SimpleVerifier.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }

    boolean isArray = type.getSort() == Type.ARRAY;
    if (isArray) {
        switch (type.getElementType().getSort()) {
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
            return new BasicValue(type);
        }
    }

    BasicValue v = super.newValue(type);
    if (BasicValue.REFERENCE_VALUE.equals(v)) {
        if (isArray) {
            v = newValue(type.getElementType());
            String desc = v.getType().getDescriptor();
            for (int i = 0; i < type.getDimensions(); ++i) {
                desc = '[' + desc;
            }
            v = new BasicValue(Type.getType(desc));
        } else {
            v = new BasicValue(type);
        }
    }
    return v;
}
 
Example 17
Source File: SimpleVerifier.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }

    boolean isArray = type.getSort() == Type.ARRAY;
    if (isArray) {
        switch (type.getElementType().getSort()) {
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
            return new BasicValue(type);
        }
    }

    BasicValue v = super.newValue(type);
    if (BasicValue.REFERENCE_VALUE.equals(v)) {
        if (isArray) {
            v = newValue(type.getElementType());
            String desc = v.getType().getDescriptor();
            for (int i = 0; i < type.getDimensions(); ++i) {
                desc = '[' + desc;
            }
            v = new BasicValue(Type.getType(desc));
        } else {
            v = new BasicValue(type);
        }
    }
    return v;
}
 
Example 18
Source File: SimpleVerifier.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }

    boolean isArray = type.getSort() == Type.ARRAY;
    if (isArray) {
        switch (type.getElementType().getSort()) {
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
            return new BasicValue(type);
        }
    }

    BasicValue v = super.newValue(type);
    if (BasicValue.REFERENCE_VALUE.equals(v)) {
        if (isArray) {
            v = newValue(type.getElementType());
            String desc = v.getType().getDescriptor();
            for (int i = 0; i < type.getDimensions(); ++i) {
                desc = '[' + desc;
            }
            v = new BasicValue(Type.getType(desc));
        } else {
            v = new BasicValue(type);
        }
    }
    return v;
}
 
Example 19
Source File: SimpleVerifier.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }

    boolean isArray = type.getSort() == Type.ARRAY;
    if (isArray) {
        switch (type.getElementType().getSort()) {
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
            return new BasicValue(type);
        }
    }

    BasicValue v = super.newValue(type);
    if (BasicValue.REFERENCE_VALUE.equals(v)) {
        if (isArray) {
            v = newValue(type.getElementType());
            String desc = v.getType().getDescriptor();
            for (int i = 0; i < type.getDimensions(); ++i) {
                desc = '[' + desc;
            }
            v = new BasicValue(Type.getType(desc));
        } else {
            v = new BasicValue(type);
        }
    }
    return v;
}
 
Example 20
Source File: SimpleVerifier.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }

    boolean isArray = type.getSort() == Type.ARRAY;
    if (isArray) {
        switch (type.getElementType().getSort()) {
            case Type.BOOLEAN:
            case Type.CHAR:
            case Type.BYTE:
            case Type.SHORT:
                return new BasicValue(type);
        }
    }

    BasicValue v = super.newValue(type);
    if (BasicValue.REFERENCE_VALUE.equals(v)) {
        if (isArray) {
            v = newValue(type.getElementType());
            String desc = v.getType().getDescriptor();
            for (int i = 0; i < type.getDimensions(); ++i) {
                desc = '[' + desc;
            }
            v = new BasicValue(Type.getType(desc));
        } else {
            v = new BasicValue(type);
        }
    }
    return v;
}