本文整理汇总了Java中com.sun.jdi.ClassNotLoadedException类的典型用法代码示例。如果您正苦于以下问题:Java ClassNotLoadedException类的具体用法?Java ClassNotLoadedException怎么用?Java ClassNotLoadedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassNotLoadedException类属于com.sun.jdi包,在下文中一共展示了ClassNotLoadedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: autoboxArguments
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
/**
* Auto-boxes or un-boxes arguments of a method.
*/
static void autoboxArguments(List<Type> types, List<Value> argVals,
ThreadReference evaluationThread,
EvaluationContext evaluationContext) throws InvalidTypeException,
ClassNotLoadedException,
IncompatibleThreadStateException,
InvocationException {
if (types.size() != argVals.size()) {
return ;
}
int n = types.size();
for (int i = 0; i < n; i++) {
Type t = types.get(i);
Value v = argVals.get(i);
if (v instanceof ObjectReference && t instanceof PrimitiveType) {
argVals.set(i, unbox((ObjectReference) v, (PrimitiveType) t, evaluationThread, evaluationContext));
}
if (v instanceof PrimitiveValue && t instanceof ReferenceType) {
argVals.set(i, box((PrimitiveValue) v, (ReferenceType) t, evaluationThread, evaluationContext));
}
}
}
示例2: setValue
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
@Override
public void setValue(Value value) {
try {
if (fieldObject != null) {
fieldObject.setValue(field, value);
} else {
((ClassType) field.declaringType()).setValue(field, value);
}
} catch (IllegalArgumentException iaex) {
throw new IllegalStateException(new InvalidExpressionException (iaex));
} catch (InvalidTypeException itex) {
throw new IllegalStateException(new InvalidExpressionException (itex));
} catch (ClassNotLoadedException cnlex) {
throw new IllegalStateException(cnlex);
}
}
示例3: findType
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
Type findType(String signature) throws ClassNotLoadedException {
Type type;
if (signature.length() == 1) {
/* OTI FIX: Must be a primitive type or the void type */
char sig = signature.charAt(0);
if (sig == 'V') {
type = vm.theVoidType();
} else {
type = vm.primitiveTypeMirror((byte)sig);
}
} else {
// Must be a reference type.
ClassLoaderReferenceImpl loader =
(ClassLoaderReferenceImpl)classLoader();
if ((loader == null) ||
(isPrimitiveArray(signature)) //Work around 4450091
) {
// Caller wants type of boot class field
type = vm.findBootType(signature);
} else {
// Caller wants type of non-boot class field
type = loader.findType(signature);
}
}
return type;
}
示例4: convertForAssignmentTo
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
ValueImpl convertForAssignmentTo(ValueContainer destination)
throws InvalidTypeException
{
/*
* TO DO: Centralize JNI signature knowledge
*/
if (destination.signature().length() > 1) {
throw new InvalidTypeException("Can't assign primitive value to object");
}
if ((destination.signature().charAt(0) == 'Z') &&
(type().signature().charAt(0) != 'Z')) {
throw new InvalidTypeException("Can't assign non-boolean value to a boolean");
}
if ((destination.signature().charAt(0) != 'Z') &&
(type().signature().charAt(0) == 'Z')) {
throw new InvalidTypeException("Can't assign boolean value to an non-boolean");
}
if ("void".equals(destination.typeName())) {
throw new InvalidTypeException("Can't assign primitive value to a void");
}
try {
PrimitiveTypeImpl primitiveType = (PrimitiveTypeImpl)destination.type();
return (ValueImpl)(primitiveType.convert(this));
} catch (ClassNotLoadedException e) {
throw new InternalException("Signature and type inconsistent for: " +
destination.typeName());
}
}
示例5: prepareForAssignment
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
static ValueImpl prepareForAssignment(Value value,
ValueContainer destination)
throws InvalidTypeException, ClassNotLoadedException {
if (value == null) {
/*
* TO DO: Centralize JNI signature knowledge
*/
if (destination.signature().length() == 1) {
throw new InvalidTypeException("Can't set a primitive type to null");
}
return null; // no further checking or conversion necessary
} else {
return ((ValueImpl)value).prepareForAssignmentTo(destination);
}
}
示例6: findComponentType
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
Type findComponentType(String signature) throws ClassNotLoadedException {
byte tag = (byte)signature.charAt(0);
if (PacketStream.isObjectTag(tag)) {
// It's a reference type
JNITypeParser parser = new JNITypeParser(componentSignature());
List<ReferenceType> list = vm.classesByName(parser.typeName());
Iterator<ReferenceType> iter = list.iterator();
while (iter.hasNext()) {
ReferenceType type = iter.next();
ClassLoaderReference cl = type.classLoader();
if ((cl == null)?
(classLoader() == null) :
(cl.equals(classLoader()))) {
return type;
}
}
// Component class has not yet been loaded
throw new ClassNotLoadedException(componentTypeName());
} else {
// It's a primitive type
return vm.primitiveTypeMirror(tag);
}
}
示例7: isAssignableTo
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
boolean isAssignableTo(ReferenceType destType) {
if (destType instanceof ArrayType) {
try {
Type destComponentType = ((ArrayType)destType).componentType();
return isComponentAssignable(destComponentType, componentType());
} catch (ClassNotLoadedException e) {
// One or both component types has not yet been
// loaded => can't assign
return false;
}
} else if (destType instanceof InterfaceType) {
// Only valid InterfaceType assignee is Cloneable
return destType.name().equals("java.lang.Cloneable");
} else {
// Only valid ClassType assignee is Object
return destType.name().equals("java.lang.Object");
}
}
示例8: handleSetValueForObject
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
private Value handleSetValueForObject(String name, String belongToClass, String valueString,
ObjectReference container, Map<String, Object> options) throws InvalidTypeException, ClassNotLoadedException {
Value newValue;
if (container instanceof ArrayReference) {
ArrayReference array = (ArrayReference) container;
Type eleType = ((ArrayType) array.referenceType()).componentType();
newValue = setArrayValue(array, eleType, Integer.parseInt(name), valueString, options);
} else {
if (StringUtils.isBlank(belongToClass)) {
Field field = container.referenceType().fieldByName(name);
if (field != null) {
if (field.isStatic()) {
newValue = this.setStaticFieldValue(container.referenceType(), field, name, valueString, options);
} else {
newValue = this.setObjectFieldValue(container, field, name, valueString, options);
}
} else {
throw new IllegalArgumentException(
String.format("SetVariableRequest: Variable %s cannot be found.", name));
}
} else {
newValue = setFieldValueWithConflict(container, container.referenceType().allFields(), name, belongToClass, valueString, options);
}
}
return newValue;
}
示例9: setFieldValueWithConflict
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
private Value setFieldValueWithConflict(ObjectReference obj, List<Field> fields, String name, String belongToClass,
String value, Map<String, Object> options) throws ClassNotLoadedException, InvalidTypeException {
Field field;
// first try to resolve field by fully qualified name
List<Field> narrowedFields = fields.stream().filter(TypeComponent::isStatic)
.filter(t -> t.name().equals(name) && t.declaringType().name().equals(belongToClass))
.collect(Collectors.toList());
if (narrowedFields.isEmpty()) {
// second try to resolve field by formatted name
narrowedFields = fields.stream().filter(TypeComponent::isStatic)
.filter(t -> t.name().equals(name)
&& context.getVariableFormatter().typeToString(t.declaringType(), options).equals(belongToClass))
.collect(Collectors.toList());
}
if (narrowedFields.size() == 1) {
field = narrowedFields.get(0);
} else {
throw new UnsupportedOperationException(String.format("SetVariableRequest: Name conflicted for %s.", name));
}
return field.isStatic() ? setStaticFieldValue(field.declaringType(), field, name, value, options)
: this.setObjectFieldValue(obj, field, name, value, options);
}
示例10: findType
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
Type findType(String signature) throws ClassNotLoadedException {
Type type;
if (signature.length() == 1) {
/* OTI FIX: Must be a primitive type or the void type */
char sig = signature.charAt(0);
if (sig == 'V') {
type = vm.theVoidType();
} else {
type = vm.primitiveTypeMirror(sig);
}
} else {
// Must be a reference type.
ClassLoaderReferenceImpl loader =
(ClassLoaderReferenceImpl)classLoader();
if ((loader == null) ||
(isPrimitiveArray(signature)) //Work around 4450091
) {
// Caller wants type of boot class field
type = vm.findBootType(signature);
} else {
// Caller wants type of non-boot class field
type = loader.findType(signature);
}
}
return type;
}
示例11: isAssignableTo
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
boolean isAssignableTo(ReferenceType destType) {
if (destType instanceof ArrayType) {
try {
Type destComponentType = ((ArrayType)destType).componentType();
return isComponentAssignable(destComponentType, componentType());
} catch (ClassNotLoadedException e) {
// One or both component types has not yet been
// loaded => can't assign
return false;
}
} else {
Symbol typeName = ((ReferenceTypeImpl)destType).typeNameAsSymbol();
if (destType instanceof InterfaceType) {
// Every array type implements java.io.Serializable and
// java.lang.Cloneable. fixme in JVMDI-JDI, includes only
// Cloneable but not Serializable.
return typeName.equals(vm.javaLangCloneable()) ||
typeName.equals(vm.javaIoSerializable());
} else {
// Only valid ClassType assignee is Object
return typeName.equals(vm.javaLangObject());
}
}
}
示例12: getModifiers
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
int getModifiers() {
/*
* For object arrays, the return values for Interface
* Accessible.isPrivate(), Accessible.isProtected(),
* etc... are the same as would be returned for the
* component type. Fetch the modifier bits from the
* component type and use those.
*
* For primitive arrays, the modifiers are always
* VMModifiers.FINAL | VMModifiers.PUBLIC
*
* Reference com.sun.jdi.Accessible.java.
*/
try {
Type t = componentType();
if (t instanceof PrimitiveType) {
return VMModifiers.FINAL | VMModifiers.PUBLIC;
} else {
ReferenceType rt = (ReferenceType)t;
return rt.modifiers();
}
} catch (ClassNotLoadedException cnle) {
cnle.printStackTrace();
}
return -1;
}
示例13: createVariable
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
private void createVariable(final LocalVariable var, final int lineFrom, final int lineTo,
final IMethodNode methodNode)
{
ITypeNodeRef varTypeNode;
try
{
varTypeNode = upstream.resolveType(var.type().signature(), var.typeName());
}
catch (final ClassNotLoadedException e)
{
varTypeNode = modelFactory().lookupTypeRefByName(var.typeName());
}
methodNode.addDataMember(var.name(), lineFrom, lineTo, varTypeNode, NO_JDI,
createModifiers(var), NodeVisibility.NV_LOCAL, model.valueFactory()
.createUninitializedValue());
}
示例14: createField
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
void createField(final Field field, final int lineFrom, final int lineTo, final ITypeNode typeNode)
{
// this field never generates a field read or field write event
if (!filter.acceptsType(field.declaringType()) || !filter.acceptsField(field))
{
return;
}
ITypeNodeRef fieldTypeNode;
try
{
fieldTypeNode = upstream.resolveType(field.type().signature(), field.typeName());
}
catch (final ClassNotLoadedException e)
{
fieldTypeNode = modelFactory().lookupTypeRefByName(field.typeName());
}
typeNode.addDataMember(field.name(), lineFrom, lineTo, fieldTypeNode, NO_JDI,
createModifiers(field), createVisibility(field),
fieldTypeNode instanceof ITypeNode ? ((ITypeNode) fieldTypeNode).defaultValue() : model
.valueFactory().createNullValue());
}
示例15: jdiTypeLoadArray
import com.sun.jdi.ClassNotLoadedException; //导入依赖的package包/类
public void jdiTypeLoadArray(final ArrayType type)
{
try
{
final Type componentType = type.componentType();
if (componentType instanceof ReferenceType)
{
jdiTypeLoad(((ReferenceType) componentType));
}
}
catch (final ClassNotLoadedException e)
{
System.err.println("Error: type not loaded for array '" + type.signature() + "'");
//
String componentTypeName = type.signature();
componentTypeName = componentTypeName.substring(componentTypeName.lastIndexOf('[') + 1);
//
registry.getTypeId(componentTypeName);
}
jdiTypeLoadComplete(type);
}