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

The following examples show how to use jdk.internal.org.objectweb.asm.Type#getMethodType() . 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 TencentKona-8 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 2
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 3
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 4
Source File: JavaAdapterBytecodeGenerator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 5
Source File: Remapper.java    From hottub 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-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: JavaAdapterBytecodeGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private int emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc, final boolean constructor) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (!constructor && Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        final Class<?> superType = findInvokespecialOwnerFor(owner);
        mv.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(superType), name, methodDesc,
            Modifier.isInterface(superType.getModifiers()));
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    return nextParam;
}
 
Example 8
Source File: Remapper.java    From openjdk-jdk9 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 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 10
Source File: JavaAdapterBytecodeGenerator.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
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: JavaAdapterBytecodeGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 13
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 14
Source File: JavaAdapterBytecodeGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        mv.invokespecial(Type.getInternalName(owner), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 15
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 16
Source File: JavaAdapterBytecodeGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final Class<?> owner, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }

    // default method - non-abstract, interface method
    if (Modifier.isInterface(owner.getModifiers())) {
        // we should call default method on the immediate "super" type - not on (possibly)
        // the indirectly inherited interface class!
        mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
    } else {
        mv.invokespecial(superClassName, name, methodDesc, false);
    }
    mv.areturn(methodType.getReturnType());
}
 
Example 17
Source File: Remapper.java    From dragonwell8_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 18
Source File: JavaAdapterBytecodeGenerator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }
    mv.invokespecial(superClassName, name, methodDesc);
    mv.areturn(methodType.getReturnType());
}
 
Example 19
Source File: JavaAdapterBytecodeGenerator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }
    mv.invokespecial(superClassName, name, methodDesc);
    mv.areturn(methodType.getReturnType());
}
 
Example 20
Source File: JavaAdapterBytecodeGenerator.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private void emitSuperCall(final InstructionAdapter mv, final String name, final String methodDesc) {
    mv.visitVarInsn(ALOAD, 0);
    int nextParam = 1;
    final Type methodType = Type.getMethodType(methodDesc);
    for(final Type t: methodType.getArgumentTypes()) {
        mv.load(nextParam, t);
        nextParam += t.getSize();
    }
    mv.invokespecial(superClassName, name, methodDesc);
    mv.areturn(methodType.getReturnType());
}