當前位置: 首頁>>代碼示例>>Java>>正文


Java Type.getParameterTypes方法代碼示例

本文整理匯總了Java中com.sun.tools.javac.code.Type.getParameterTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java Type.getParameterTypes方法的具體用法?Java Type.getParameterTypes怎麽用?Java Type.getParameterTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.tools.javac.code.Type的用法示例。


在下文中一共展示了Type.getParameterTypes方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: typeToMethodType

import com.sun.tools.javac.code.Type; //導入方法依賴的package包/類
private MethodType typeToMethodType(Type mt) {
    Type type = types.erasure(mt);
    return new MethodType(type.getParameterTypes(),
                    type.getReturnType(),
                    type.getThrownTypes(),
                    syms.methodClass);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:8,代碼來源:LambdaToMethod.java

示例2: getParameterSignature

import com.sun.tools.javac.code.Type; //導入方法依賴的package包/類
StringBuilder getParameterSignature(Type mType)
        throws SignatureException {
    StringBuilder result = new StringBuilder();
    for (Type pType : mType.getParameterTypes()) {
        result.append(getJvmSignature(pType));
    }
    return result;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:JNIWriter.java

示例3: addParametersReturnReceiver

import com.sun.tools.javac.code.Type; //導入方法依賴的package包/類
/**
 * Generate the parameter list for the converted member reference.
 *
 * @return The receiver variable symbol, if any
 */
VarSymbol addParametersReturnReceiver() {
    Type samDesc = localContext.bridgedRefSig();
    List<Type> samPTypes = samDesc.getParameterTypes();
    List<Type> descPTypes = tree.getDescriptorType(types).getParameterTypes();

    // Determine the receiver, if any
    VarSymbol rcvr;
    switch (tree.kind) {
        case BOUND:
            // The receiver is explicit in the method reference
            rcvr = addParameter("rec$", tree.getQualifierExpression().type, false);
            receiverExpression = attr.makeNullCheck(tree.getQualifierExpression());
            break;
        case UNBOUND:
            // The receiver is the first parameter, extract it and
            // adjust the SAM and unerased type lists accordingly
            rcvr = addParameter("rec$", samDesc.getParameterTypes().head, false);
            samPTypes = samPTypes.tail;
            descPTypes = descPTypes.tail;
            break;
        default:
            rcvr = null;
            break;
    }
    List<Type> implPTypes = tree.sym.type.getParameterTypes();
    int implSize = implPTypes.size();
    int samSize = samPTypes.size();
    // Last parameter to copy from referenced method, exclude final var args
    int last = localContext.needsVarArgsConversion() ? implSize - 1 : implSize;

    // Failsafe -- assure match-up
    boolean checkForIntersection = tree.varargsElement != null || implSize == descPTypes.size();

    // Use parameter types of the implementation method unless the unerased
    // SAM parameter type is an intersection type, in that case use the
    // erased SAM parameter type so that the supertype relationship
    // the implementation method parameters is not obscured.
    // Note: in this loop, the lists implPTypes, samPTypes, and descPTypes
    // are used as pointers to the current parameter type information
    // and are thus not usable afterwards.
    for (int i = 0; implPTypes.nonEmpty() && i < last; ++i) {
        // By default use the implementation method parmeter type
        Type parmType = implPTypes.head;
        // If the unerased parameter type is a type variable whose
        // bound is an intersection (eg. <T extends A & B>) then
        // use the SAM parameter type
        if (checkForIntersection && descPTypes.head.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) descPTypes.head;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                parmType = samPTypes.head;
            }
        }
        addParameter("x$" + i, parmType, true);

        // Advance to the next parameter
        implPTypes = implPTypes.tail;
        samPTypes = samPTypes.tail;
        descPTypes = descPTypes.tail;
    }
    // Flatten out the var args
    for (int i = last; i < samSize; ++i) {
        addParameter("xva$" + i, tree.varargsElement, true);
    }

    return rcvr;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:72,代碼來源:LambdaToMethod.java


注:本文中的com.sun.tools.javac.code.Type.getParameterTypes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。