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


Java Empty类代码示例

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


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

示例1: uninitializedCallSite

import sun.invoke.empty.Empty; //导入依赖的package包/类
MethodHandle uninitializedCallSite() {
    MethodHandle invoker = uninitializedCallSite;
    if (invoker != null)  return invoker;
    if (targetType.parameterCount() > 0) {
        MethodType type0 = targetType.dropParameterTypes(0, targetType.parameterCount());
        Invokers invokers0 = type0.invokers();
        invoker = MethodHandles.dropArguments(invokers0.uninitializedCallSite(),
                                              0, targetType.parameterList());
        assert(invoker.type().equals(targetType));
        uninitializedCallSite = invoker;
        return invoker;
    }
    if (THROW_UCS == null) {
        try {
            THROW_UCS = IMPL_LOOKUP
                .findStatic(CallSite.class, "uninitializedCallSite",
                            MethodType.methodType(Empty.class));
        } catch (ReflectiveOperationException ex) {
            throw new RuntimeException(ex);
        }
    }
    invoker = AdapterMethodHandle.makeRetypeRaw(targetType, THROW_UCS);
    assert(invoker.type().equals(targetType));
    uninitializedCallSite = invoker;
    return invoker;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:27,代码来源:Invokers.java

示例2: isNullType

import sun.invoke.empty.Empty; //导入依赖的package包/类
/**
 * Is the given type java.lang.Null or an equivalent null-only type?
 */
public static boolean isNullType(Class<?> type) {
    // Any reference statically typed as Void is guaranteed to be null.
    // Therefore, it can be safely treated as a value of any
    // other type that admits null, i.e., a reference type.
    if (type == Void.class)  return true;
    // Locally known null-only class:
    if (type == Empty.class)  return true;
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:VerifyType.java

示例3: uninitializedCallSite

import sun.invoke.empty.Empty; //导入依赖的package包/类
MethodHandle uninitializedCallSite() {
    MethodHandle invoker = uninitializedCallSite;
    if (invoker != null)  return invoker;
    if (targetType.parameterCount() > 0) {
        MethodType type0 = targetType.dropParameterTypes(0, targetType.parameterCount());
        Invokers invokers0 = type0.invokers();
        invoker = MethodHandles.dropArguments(invokers0.uninitializedCallSite(),
                                              0, targetType.parameterList());
        assert(invoker.type().equals(targetType));
        uninitializedCallSite = invoker;
        return invoker;
    }
    invoker = THROW_UCS;
    if (invoker == null) {
        try {
            THROW_UCS = invoker = IMPL_LOOKUP
                .findStatic(CallSite.class, "uninitializedCallSite",
                            MethodType.methodType(Empty.class));
        } catch (ReflectiveOperationException ex) {
            throw newInternalError(ex);
        }
    }
    invoker = MethodHandles.explicitCastArguments(invoker, MethodType.methodType(targetType.returnType()));
    invoker = invoker.dropArguments(targetType, 0, targetType.parameterCount());
    assert(invoker.type().equals(targetType));
    uninitializedCallSite = invoker;
    return invoker;
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:29,代码来源:Invokers.java

示例4: throwException

import sun.invoke.empty.Empty; //导入依赖的package包/类
static MethodHandle throwException() {
    MethodHandle mh = THROW_EXCEPTION;
    if (mh != null)  return mh;
    try {
        mh
        = IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "throwException",
                MethodType.methodType(Empty.class, Throwable.class));
    } catch (ReflectiveOperationException ex) {
        throw new RuntimeException(ex);
    }
    THROW_EXCEPTION = mh;
    return mh;
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:14,代码来源:MethodHandleImpl.java

示例5: throwException

import sun.invoke.empty.Empty; //导入依赖的package包/类
static MethodHandle throwException() {
    if (THROW_EXCEPTION != null)  return THROW_EXCEPTION;
    try {
        THROW_EXCEPTION
        = IMPL_LOOKUP.findStatic(MethodHandleImpl.class, "throwException",
                MethodType.methodType(Empty.class, Throwable.class));
    } catch (ReflectiveOperationException ex) {
        throw new RuntimeException(ex);
    }
    return THROW_EXCEPTION;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:12,代码来源:MethodHandleImpl.java

示例6: isNullType

import sun.invoke.empty.Empty; //导入依赖的package包/类
/**
 * Is the given type java.lang.Null or an equivalent null-only type?
 */
public static boolean isNullType(Class<?> type) {
    if (type == null)  return false;
    return type == NULL_CLASS
        // This one may also be used as a null type.
        // TO DO: Decide if we really want to legitimize it here.
        // Probably we do, unless java.lang.Null really makes it into Java 7
        //|| type == Void.class
        // Locally known null-only class:
        || type == Empty.class
        ;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:15,代码来源:VerifyType.java

示例7: uninitializedCallSite

import sun.invoke.empty.Empty; //导入依赖的package包/类
/** This guy is rolled into the default target if a MethodType is supplied to the constructor. */
/*package-private*/
static Empty uninitializedCallSite() {
    throw new IllegalStateException("uninitialized call site");
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:6,代码来源:CallSite.java

示例8: throwException

import sun.invoke.empty.Empty; //导入依赖的package包/类
static <T extends Throwable> Empty throwException(T t) throws T { throw t; } 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:2,代码来源:MethodHandleImpl.java


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