本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
;
}
示例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");
}
示例8: throwException
import sun.invoke.empty.Empty; //导入依赖的package包/类
static <T extends Throwable> Empty throwException(T t) throws T { throw t; }