当前位置: 首页>>代码示例>>Java>>正文


Java BytecodeDescriptor类代码示例

本文整理汇总了Java中sun.invoke.util.BytecodeDescriptor的典型用法代码示例。如果您正苦于以下问题:Java BytecodeDescriptor类的具体用法?Java BytecodeDescriptor怎么用?Java BytecodeDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BytecodeDescriptor类属于sun.invoke.util包,在下文中一共展示了BytecodeDescriptor类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSignature

import sun.invoke.util.BytecodeDescriptor; //导入依赖的package包/类
/** Utility method to produce the signature of this member,
 *  used within the class file format to describe its type.
 */
public String getSignature() {
    if (type == null) {
        expandFromVM();
        if (type == null) {
            return null;
        }
    }
    if (isInvocable())
        return BytecodeDescriptor.unparse(getMethodType());
    else
        return BytecodeDescriptor.unparse(getFieldType());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:MemberName.java

示例2: fromDescriptor

import sun.invoke.util.BytecodeDescriptor; //导入依赖的package包/类
/**
 * Same as {@link #fromMethodDescriptorString(String, ClassLoader)}, but
 * {@code null} ClassLoader means the bootstrap loader is used here.
 * <p>
 * IMPORTANT: This method is preferable for JDK internal use as it more
 * correctly interprets {@code null} ClassLoader than
 * {@link #fromMethodDescriptorString(String, ClassLoader)}.
 * Use of this method also avoids early initialization issues when system
 * ClassLoader is not initialized yet.
 */
static MethodType fromDescriptor(String descriptor, ClassLoader loader)
    throws IllegalArgumentException, TypeNotPresentException
{
    if (!descriptor.startsWith("(") ||  // also generates NPE if needed
        descriptor.indexOf(')') < 0 ||
        descriptor.indexOf('.') >= 0)
        throw newIllegalArgumentException("not a method descriptor: "+descriptor);
    List<Class<?>> types = BytecodeDescriptor.parseMethod(descriptor, loader);
    Class<?> rtype = types.remove(types.size() - 1);
    Class<?>[] ptypes = listToArray(types);
    return makeImpl(rtype, ptypes, true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:MethodType.java

示例3: getSignature

import sun.invoke.util.BytecodeDescriptor; //导入依赖的package包/类
/** Utility method to produce the signature of this member,
 *  used within the class file format to describe its type.
 */
public String getSignature() {
    if (type == null) {
        expandFromVM();
        if (type == null)  return null;
    }
    if (type instanceof String)
        return (String) type;
    if (isInvocable())
        return BytecodeDescriptor.unparse(getMethodType());
    else
        return BytecodeDescriptor.unparse(getFieldType());
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:16,代码来源:MemberName.java

示例4: toFieldDescriptorString

import sun.invoke.util.BytecodeDescriptor; //导入依赖的package包/类
static String toFieldDescriptorString(Class<?> cls) {
    return BytecodeDescriptor.unparse(cls);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:MethodType.java

示例5: getMembers

import sun.invoke.util.BytecodeDescriptor; //导入依赖的package包/类
List<MemberName> getMembers(Class<?> defc,
        String matchName, Object matchType,
        int matchFlags, Class<?> lookupClass) {
    matchFlags &= ALLOWED_FLAGS;
    String matchSig = null;
    if (matchType != null) {
        matchSig = BytecodeDescriptor.unparse(matchType);
        if (matchSig.startsWith("("))
            matchFlags &= ~(ALL_KINDS & ~IS_INVOCABLE);
        else
            matchFlags &= ~(ALL_KINDS & ~IS_FIELD);
    }
    final int BUF_MAX = 0x2000;
    int len1 = matchName == null ? 10 : matchType == null ? 4 : 1;
    MemberName[] buf = newMemberBuffer(len1);
    int totalCount = 0;
    ArrayList<MemberName[]> bufs = null;
    int bufCount = 0;
    for (;;) {
        bufCount = MethodHandleNatives.getMembers(defc,
                matchName, matchSig, matchFlags,
                lookupClass,
                totalCount, buf);
        if (bufCount <= buf.length) {
            if (bufCount < 0)  bufCount = 0;
            totalCount += bufCount;
            break;
        }
        // JVM returned to us with an intentional overflow!
        totalCount += buf.length;
        int excess = bufCount - buf.length;
        if (bufs == null)  bufs = new ArrayList<>(1);
        bufs.add(buf);
        int len2 = buf.length;
        len2 = Math.max(len2, excess);
        len2 = Math.max(len2, totalCount / 4);
        buf = newMemberBuffer(Math.min(BUF_MAX, len2));
    }
    ArrayList<MemberName> result = new ArrayList<>(totalCount);
    if (bufs != null) {
        for (MemberName[] buf0 : bufs) {
            Collections.addAll(result, buf0);
        }
    }
    result.addAll(Arrays.asList(buf).subList(0, bufCount));
    // Signature matching is not the same as type matching, since
    // one signature might correspond to several types.
    // So if matchType is a Class or MethodType, refilter the results.
    if (matchType != null && matchType != matchSig) {
        for (Iterator<MemberName> it = result.iterator(); it.hasNext();) {
            MemberName m = it.next();
            if (!matchType.equals(m.getType()))
                it.remove();
        }
    }
    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:58,代码来源:MemberName.java

示例6: getMembers

import sun.invoke.util.BytecodeDescriptor; //导入依赖的package包/类
List<MemberName> getMembers(Class<?> defc,
        String matchName, Object matchType,
        int matchFlags, Class<?> lookupClass) {
    matchFlags &= ALLOWED_FLAGS;
    String matchSig = null;
    if (matchType != null) {
        matchSig = BytecodeDescriptor.unparse(matchType);
        if (matchSig.startsWith("("))
            matchFlags &= ~(ALL_KINDS & ~IS_INVOCABLE);
        else
            matchFlags &= ~(ALL_KINDS & ~IS_FIELD);
    }
    final int BUF_MAX = 0x2000;
    int len1 = matchName == null ? 10 : matchType == null ? 4 : 1;
    MemberName[] buf = newMemberBuffer(len1);
    int totalCount = 0;
    ArrayList<MemberName[]> bufs = null;
    int bufCount = 0;
    for (;;) {
        bufCount = MethodHandleNatives.getMembers(defc,
                matchName, matchSig, matchFlags,
                lookupClass,
                totalCount, buf);
        if (bufCount <= buf.length) {
            if (bufCount < 0)  bufCount = 0;
            totalCount += bufCount;
            break;
        }
        // JVM returned to us with an intentional overflow!
        totalCount += buf.length;
        int excess = bufCount - buf.length;
        if (bufs == null)  bufs = new ArrayList<>(1);
        bufs.add(buf);
        int len2 = buf.length;
        len2 = Math.max(len2, excess);
        len2 = Math.max(len2, totalCount / 4);
        buf = newMemberBuffer(Math.min(BUF_MAX, len2));
    }
    ArrayList<MemberName> result = new ArrayList<>(totalCount);
    if (bufs != null) {
        for (MemberName[] buf0 : bufs) {
            Collections.addAll(result, buf0);
        }
    }
    for (int i = 0; i < bufCount; i++) {
        result.add(buf[i]);
    }
    // Signature matching is not the same as type matching, since
    // one signature might correspond to several types.
    // So if matchType is a Class or MethodType, refilter the results.
    if (matchType != null && matchType != matchSig) {
        for (Iterator<MemberName> it = result.iterator(); it.hasNext();) {
            MemberName m = it.next();
            if (!matchType.equals(m.getType()))
                it.remove();
        }
    }
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:60,代码来源:MemberName.java

示例7: getMembers

import sun.invoke.util.BytecodeDescriptor; //导入依赖的package包/类
List<MemberName> getMembers(Class<?> defc,
        String matchName, Object matchType,
        int matchFlags, Class<?> lookupClass) {
    matchFlags &= ALLOWED_FLAGS;
    String matchSig = null;
    if (matchType != null) {
        matchSig = BytecodeDescriptor.unparse(matchType);
        if (matchSig.startsWith("("))
            matchFlags &= ~(ALL_KINDS & ~IS_INVOCABLE);
        else
            matchFlags &= ~(ALL_KINDS & ~IS_FIELD);
    }
    final int BUF_MAX = 0x2000;
    int len1 = matchName == null ? 10 : matchType == null ? 4 : 1;
    MemberName[] buf = newMemberBuffer(len1);
    int totalCount = 0;
    ArrayList<MemberName[]> bufs = null;
    int bufCount = 0;
    for (;;) {
        bufCount = MethodHandleNatives.getMembers(defc,
                matchName, matchSig, matchFlags,
                lookupClass,
                totalCount, buf);
        if (bufCount <= buf.length) {
            if (bufCount < 0)  bufCount = 0;
            totalCount += bufCount;
            break;
        }
        // JVM returned to us with an intentional overflow!
        totalCount += buf.length;
        int excess = bufCount - buf.length;
        if (bufs == null)  bufs = new ArrayList<MemberName[]>(1);
        bufs.add(buf);
        int len2 = buf.length;
        len2 = Math.max(len2, excess);
        len2 = Math.max(len2, totalCount / 4);
        buf = newMemberBuffer(Math.min(BUF_MAX, len2));
    }
    ArrayList<MemberName> result = new ArrayList<MemberName>(totalCount);
    if (bufs != null) {
        for (MemberName[] buf0 : bufs) {
            Collections.addAll(result, buf0);
        }
    }
    result.addAll(Arrays.asList(buf).subList(0, bufCount));
    // Signature matching is not the same as type matching, since
    // one signature might correspond to several types.
    // So if matchType is a Class or MethodType, refilter the results.
    if (matchType != null && matchType != matchSig) {
        for (Iterator<MemberName> it = result.iterator(); it.hasNext();) {
            MemberName m = it.next();
            if (!matchType.equals(m.getType()))
                it.remove();
        }
    }
    return result;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:58,代码来源:MemberName.java


注:本文中的sun.invoke.util.BytecodeDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。