本文整理了Java中java.lang.VerifyError.<init>()
方法的一些代码示例,展示了VerifyError.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VerifyError.<init>()
方法的具体详情如下:
包路径:java.lang.VerifyError
类名称:VerifyError
方法名:<init>
[英]Constructs a new VerifyError that includes the current stack trace.
[中]构造包含当前堆栈跟踪的新VerifyError。
代码示例来源:origin: lenskit/lenskit
task.addMetric(metric);
} else {
throw new VerifyError("cannot build metric for " + mn.toString());
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verifyReferenceOrArray(TypeMirror cw)
{
switch (cw.getKind())
{
case ARRAY:
case DECLARED:
case TYPEVAR:
return;
default:
throw new VerifyError(cw+" not assignable to array");
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verifyByteOrBoolean(TypeMirror cw)
{
switch (cw.getKind())
{
case BYTE:
case BOOLEAN:
return;
default:
throw new VerifyError(cw+" not byte or boolean");
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
/**
* Returns a element from constant map
* @param index
* @return
*/
Object getIndexedType(int index)
{
Object ae = indexedElementMap.get(index);
if (ae == null)
{
throw new VerifyError("constant pool at "+index+" not proper type");
}
return ae;
}
/**
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verify1(TypeMirror cls)
{
if (!c1(cls))
{
throw new VerifyError(cls+" not category 1");
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verifyVirtualClass(TypeMirror objectRef, ExecutableElement method)
{
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
if (!Typ.isAssignable(objectRef, declaringClass.asType()))
{
throw new VerifyError("class "+objectRef+" not assignable for method class "+declaringClass+" in method "+method);
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private VariableElement getIndexedVariable(int i)
{
Object indexedType = cf.getIndexedType(i);
if (indexedType instanceof VariableElement)
{
return (VariableElement) indexedType;
}
throw new VerifyError("indexed object at "+i+" not field");
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verify2(TypeMirror cls)
{
if (!c2(cls))
{
throw new VerifyError(cls+" not category 1");
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private TypeMirror getLocalType(int index)
{
TypeMirror lc = mc.getLocalType(index);
if (lc != null)
{
return lc;
}
else
{
throw new VerifyError("local variable at index "+index+" not set");
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verifyInterfaceClass(TypeMirror objectRef, ExecutableElement method)
{
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
if (!El.isInterface(declaringClass.getKind()))
{
throw new VerifyError("class "+declaringClass+" not interface");
}
if (!Typ.isAssignable(objectRef, declaringClass.asType()))
{
throw new VerifyError("class "+objectRef+" not assignable for method class "+declaringClass+" in method "+method);
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private ExecutableElement getIndexedExecutable(int i)
{
Object indexedType = cf.getIndexedType(i);
if (indexedType instanceof ExecutableElement)
{
return (ExecutableElement) indexedType;
}
throw new VerifyError("indexed object at "+i+" not method");
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private TypeMirror getIndexedType(int i)
{
Object indexedType = cf.getIndexedType(i);
if (indexedType instanceof TypeElement)
{
TypeElement te = (TypeElement) indexedType;
return te.asType();
}
if (indexedType instanceof ArrayType)
{
ArrayType at = (ArrayType) indexedType;
return at;
}
throw new VerifyError("indexed object at "+i+" not class");
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verifyClass(TypeMirror objectRef, ExecutableElement method)
{
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
if (!Typ.isAssignable(objectRef, declaringClass.asType()))
{
throw new VerifyError("object "+objectRef+" for method "+method+" not compatible");
}
/*
SubClass subClass = mc.getSubClass();
if (!subClass.referencesMethod(method))
{
throw new VerifyError("object "+objectRef+" for method "+method+" not compatible");
}
*/
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verifyByteOrBooleanArray(TypeMirror cw)
{
switch (cw.getKind())
{
case ARRAY:
ArrayType at = (ArrayType) cw;
verifyByteOrBoolean(at.getComponentType());
return;
default:
throw new VerifyError(cw+" not byte or boolean array");
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verifyLocalType(int index, TypeMirror cls)
{
TypeMirror lc = mc.getLocalType(index);
if (lc != null)
{
verify(lc, cls);
}
else
{
throw new VerifyError("local variable at index "+index+" not set");
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
public static void verifyMethod(Deque<TypeMirror> stack, ExecutableElement method) throws ClassNotFoundException
{
List<VariableElement> parameters = new ArrayList<>();
parameters.addAll(method.getParameters());
Collections.reverse(parameters);
int index = 0;
for (VariableElement ve : parameters)
{
TypeMirror sub = stack.pop();
if (Typ.isInteger(ve.asType()) && Typ.isInteger(sub))
{
// boolean, byte, char, short, int are assignable at byte code
}
else
{
if (!Typ.isAssignable(sub, ve.asType()))
{
throw new VerifyError("method "+method+" expected "+ve.asType()+" but got "+sub+" for arg "+index);
}
}
index++;
}
}
}
代码示例来源:origin: org.vesalainen.bcc/bcc
if (target < 0 || target > 0xffff)
throw new VerifyError(mc.getMethodDescription()+" goto target illegal "+target);
if (!stackBefore.equals(stackNow))
throw new VerifyError(mc.getMethodDescription()+" stack differs in branch "+pc+" -> "+target
+" before:"+stackBefore+" now :"+stackNow);
if (!compare(lvBefore, lvNow))
throw new VerifyError(mc.getMethodDescription()+" local variables differ in branch "+pc+" -> "+target
+" before:"+Arrays.toString(lvBefore)+" now :"+Arrays.toString(lvNow));
代码示例来源:origin: org.vesalainen.bcc/bcc
private void verify(TypeMirror assignee, TypeMirror assignable)
{
if (Typ.isInteger(assignee) && Typ.isInteger(assignable))
{
return;
}
if (assignable.getKind() == TypeKind.NULL && !Typ.isPrimitive(assignee) )
{
return;
}
if (!Typ.isAssignable(assignable, assignee))
{
throw new VerifyError(assignee+" not assignable from "+assignable);
}
}
代码示例来源:origin: PrisonTeam/Prison
@Override
public void verify(CommandSender sender, CommandArgument argument, String verifyName,
String[] verifyArgs, T value, String valueRaw) throws java.lang.VerifyError {
for (String include : verifyArgs) {
try {
if (transform(sender, argument, include) != value) {
throw new java.lang.VerifyError(
Prison.get().getLocaleManager().getLocalizable("includeError")
.withReplacements(valueRaw).localizeFor(sender));
}
} catch (TransformError e) {
throw (IllegalArgumentException) new IllegalArgumentException(
"Could not transform the verify argument " + include, e);
}
}
}
});
代码示例来源:origin: PrisonTeam/Prison
@Override
public void verify(CommandSender sender, CommandArgument argument, String verifyName,
String[] verifyArgs, T value, String valueRaw) throws java.lang.VerifyError {
for (String exclude : verifyArgs) {
try {
if (transform(sender, argument, exclude) == value) {
throw new java.lang.VerifyError(
Prison.get().getLocaleManager().getLocalizable("excludeError")
.withReplacements(valueRaw).localizeFor(sender));
}
} catch (TransformError e) {
throw (IllegalArgumentException) new IllegalArgumentException(
"Could not transform the verify argument " + exclude, e);
}
}
}
});
内容来源于网络,如有侵权,请联系作者删除!