本文整理汇总了Java中com.sun.jdi.ClassObjectReference类的典型用法代码示例。如果您正苦于以下问题:Java ClassObjectReference类的具体用法?Java ClassObjectReference怎么用?Java ClassObjectReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassObjectReference类属于com.sun.jdi包,在下文中一共展示了ClassObjectReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: remove
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
private synchronized boolean remove(ObjectReference component, ClassObjectReference listenerClass, LoggingListenerCallBack listener) {
Map<ClassObjectReference, Set<LoggingListenerCallBack>> listeners = componentListeners.get(component);
if (listeners == null) {
return false;
}
Set<LoggingListenerCallBack> lcb = listeners.get(listenerClass);
if (lcb == null) {
return false;
}
boolean removed = lcb.remove(listener);
if (removed) {
if (lcb.isEmpty()) {
listeners.remove(listenerClass);
if (listeners.isEmpty()) {
componentListeners.remove(component);
}
}
}
return removed;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:RemoteServices.java
示例2: stopDebuggerRemoteService
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
private void stopDebuggerRemoteService(JPDADebugger d) {
ClassObjectReference serviceClass = RemoteServices.getServiceClass(d, RemoteServices.ServiceType.AWT);
if (serviceClass == null) {
return ;
}
try {
ReferenceType serviceType = serviceClass.reflectedType();
Field awtAccessLoop = serviceType.fieldByName("awtAccessLoop"); // NOI18N
if (awtAccessLoop != null) {
((ClassType) serviceType).setValue(awtAccessLoop, serviceClass.virtualMachine().mirrorOf(false));
}
serviceClass.enableCollection();
} catch (VMDisconnectedException vdex) {
// Ignore
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:VisualDebuggerListener.java
示例3: classObject
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
public ClassObjectReference classObject() {
if (classObject == null) {
// Are classObjects unique for an Object, or
// created each time? Is this spec'ed?
synchronized(this) {
if (classObject == null) {
try {
classObject = JDWP.ReferenceType.ClassObject.
process(vm, this).classObject;
} catch (JDWPException exc) {
throw exc.toJDIException();
}
}
}
}
return classObject;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:ReferenceTypeImpl.java
示例4: wrap
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
public static F3ObjectReference wrap(F3VirtualMachine f3vm, ObjectReference ref) {
if (ref == null) {
return null;
} else if (ref instanceof ArrayReference) {
return f3vm.arrayReference((ArrayReference)ref);
} else if (ref instanceof StringReference) {
return f3vm.stringReference((StringReference)ref);
} else if (ref instanceof ThreadReference) {
return f3vm.threadReference((ThreadReference)ref);
} else if (ref instanceof ThreadGroupReference) {
return f3vm.threadGroupReference((ThreadGroupReference)ref);
} else if (ref instanceof ClassLoaderReference) {
return f3vm.classLoaderReference((ClassLoaderReference)ref);
} else if (ref instanceof ClassObjectReference) {
return f3vm.classObjectReference((ClassObjectReference)ref);
} else {
return f3vm.objectReference(ref);
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:20,代码来源:F3Wrapper.java
示例5: add
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
private synchronized boolean add(ObjectReference component, ClassObjectReference listenerClass, LoggingListenerCallBack listener) {
Map<ClassObjectReference, Set<LoggingListenerCallBack>> listeners = componentListeners.get(component);
if (listeners == null) {
listeners = new HashMap<ClassObjectReference, Set<LoggingListenerCallBack>>();
componentListeners.put(component, listeners);
}
Set<LoggingListenerCallBack> lcb = listeners.get(listenerClass);
if (lcb == null) {
lcb = new HashSet<LoggingListenerCallBack>();
listeners.put(listenerClass, lcb);
}
return lcb.add(listener);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:RemoteServices.java
示例6: getListeners
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
synchronized Set<LoggingListenerCallBack> getListeners(ObjectReference component, ClassObjectReference listenerClass) {
Map<ClassObjectReference, Set<LoggingListenerCallBack>> listeners = componentListeners.get(component);
if (listeners == null) {
return null;
}
return new HashSet<>(listeners.get(listenerClass));
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:RemoteServices.java
示例7: hasServiceAccess
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
public static boolean hasServiceAccess(JPDADebugger debugger) {
Map<ServiceType, ClassObjectReference> cs;
synchronized (remoteServiceClasses) {
cs = remoteServiceClasses.get(debugger);
}
if (cs != null) {
Boolean has;
synchronized (remoteServiceAccess) {
has = remoteServiceAccess.get(debugger);
}
return has != null && has.booleanValue();
} else {
return false;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:RemoteServices.java
示例8: getServiceClass
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
public static ClassObjectReference getServiceClass(JPDADebugger debugger, ServiceType sType) {
synchronized (remoteServiceClasses) {
Map<ServiceType, ClassObjectReference> cs = remoteServiceClasses.get(debugger);
if (cs == null) {
return null;
} else {
return cs.get(sType);
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:RemoteServices.java
示例9: ClassVariableImpl
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
/** Creates a new instance of ClassVariableImpl */
public ClassVariableImpl(
JPDADebuggerImpl debugger,
ClassObjectReference clazz,
String parentID
) {
super (
debugger,
clazz,
parentID + ".class"
);
this.clazz = clazz;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ClassVariableImpl.java
示例10: getValue
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
static String getValue (Value v) {
if (v == null) {
return "null";
}
if (v instanceof VoidValue) {
return "void";
}
if (v instanceof CharValue) {
return "\'" + v.toString () + "\'";
}
if (v instanceof PrimitiveValue) {
return v.toString ();
}
try {
if (v instanceof StringReference) {
String str = ShortenedStrings.getStringWithLengthControl((StringReference) v);
return "\"" + str + "\"";
}
if (v instanceof ClassObjectReference) {
return "class " + ReferenceTypeWrapper.name(ClassObjectReferenceWrapper.reflectedType((ClassObjectReference) v));
}
if (v instanceof ArrayReference) {
return "#" + ObjectReferenceWrapper.uniqueID((ArrayReference) v) +
"(length=" + ArrayReferenceWrapper.length((ArrayReference) v) + ")";
}
return "#" + ObjectReferenceWrapper.uniqueID((ObjectReference) v);
} catch (InternalExceptionWrapper iex) {
return "";
} catch (ObjectCollectedExceptionWrapper oex) {
return "";
} catch (VMDisconnectedExceptionWrapper dex) {
return "";
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:AbstractVariable.java
示例11: classObject
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
@Override
public ClassVariable classObject() {
ClassObjectReference co;
try {
co = ReferenceTypeWrapper.classObject(classType);
} catch (InternalExceptionWrapper | ObjectCollectedExceptionWrapper |
VMDisconnectedExceptionWrapper | UnsupportedOperationExceptionWrapper ex) {
co = null;
}
return new ClassVariableImpl(debugger, co, "");
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:JPDAClassTypeImpl.java
示例12: ClassFieldVariable
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
private ClassFieldVariable (
JPDADebuggerImpl debugger,
ClassObjectReference value,
//String className,
Field field,
String parentID,
String genericSignature,
ObjectReference objectReference
) {
super(debugger, value, field, parentID, genericSignature, objectReference);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ClassFieldVariable.java
示例13: reflectedType
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
public ReferenceType reflectedType() {
if (reflectedType == null) {
try {
JDWP.ClassObjectReference.ReflectedType reply =
JDWP.ClassObjectReference.ReflectedType.process(vm, this);
reflectedType = vm.referenceType(reply.typeID,
reply.refTypeTag);
} catch (JDWPException exc) {
throw exc.toJDIException();
}
}
return reflectedType;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:ClassObjectReferenceImpl.java
示例14: handleEvent
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
@Override
public boolean handleEvent(Event event, JDIDebugTarget target, boolean suspendVote, EventSet eventSet) {
try {
//System.out.println("Reflection: " + event);
ThreadReference thread = ((LocatableEvent)event).thread();
StackFrame stack = thread.frame(0);
ObjectReference fieldValue = stack.thisObject();
ReferenceType fieldType = fieldValue.referenceType();
//String className = ((ObjectReference)fieldValue.getValue(fieldType.fieldByName("clazz"))).invokeMethod(thread, event.virtualMachine().classesByName("java.lang.Class").get(0).methodsByName("getName").get(0), new ArrayList<Value>(0), 0).toString(); // Calling methods in the child JVM seems to crash here.
//String className = ((StringReference)((ObjectReference)fieldValue.getValue(fieldType.fieldByName("clazz"))).getValue(event.virtualMachine().classesByName("java.lang.Class").get(0).fieldByName("name"))).value(); // This works in JDK 7 but breaks in JDK 8 (because getting fields no longer calls SecurityManager.checkMemberAccess).
String className = ((ClassObjectReference)fieldValue.getValue(fieldType.fieldByName("clazz"))).reflectedType().name();
String fieldName = ((StringReference)fieldValue.getValue(fieldType.fieldByName("name"))).value();
Field field = event.virtualMachine().classesByName(className).get(0).fieldByName(fieldName);
List<Value> argValues = stack.getArgumentValues();
ObjectReference obj = (ObjectReference)argValues.get(0);
if (!field.isStatic() && obj == null)
return true; // The execution will crash.
Value oldValue = field.isStatic() ? field.declaringType().getValue(field) : obj.getValue(field);
if (argValues.size() == 2) { // We're setting the value of a field.
Value newValue = argValues.get(1);
if (newValue instanceof ObjectReference && EclipseUtils.isPrimitive(field.signature())) // Unbox primitive values.
newValue = ((ObjectReference)newValue).getValue(((ReferenceType)newValue.type()).fieldByName("value"));
recordEffect(FieldLVal.makeFieldLVal(obj, field), oldValue, newValue);
} else if (oldValue instanceof ArrayReference) // We're reading the value of an array.
backupArray(FieldLVal.makeFieldLVal(obj, field), oldValue);
} catch (IncompatibleThreadStateException e) {
throw new RuntimeException(e);
}
return true;
}
开发者ID:jgalenson,项目名称:codehint,代码行数:31,代码来源:SideEffectHandler.java
示例15: setListenerObject
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
private void setListenerObject(ObjectReference listener, ClassObjectReference listenerClass) {
this.listener = listener;
this.listenerClass = listenerClass;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:EventsModel.java
示例16: getListenerClass
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
public ClassObjectReference getListenerClass() {
return listenerClass;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:EventsModel.java
示例17: getVariable
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
public Variable getVariable (Value value) {
if (value instanceof ClassObjectReference) {
return new ClassVariableImpl(this, (ClassObjectReference) value, null);
}
return createVariable(value);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:JPDADebuggerImpl.java
示例18: createObjectOfType
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
private static ObjectReference createObjectOfType(ClassType type, VirtualMachine vm, ThreadReference thread)
throws InvalidObjectException, InternalExceptionWrapper,
VMDisconnectedExceptionWrapper, ClassNotPreparedExceptionWrapper,
ObjectCollectedExceptionWrapper, InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException, UnsupportedOperationExceptionWrapper {
com.sun.jdi.Method c = ClassTypeWrapper.concreteMethodByName(type, "<init>", "()V");
if (c == null || !c.declaringType().equals(type)) { // No no-arg constructor
//ReflectionFactory rf = ReflectionFactory.getReflectionFactory();
//constructor = rf.newConstructorForSerialization(clazz, Object.class.getDeclaredConstructor());
ClassType reflectionFactoryType = (ClassType) getOrLoadClass(vm, "sun.reflect.ReflectionFactory");
if (reflectionFactoryType == null) {
throw new InvalidObjectException("No constructor for "+TypeWrapper.name(type));
}
com.sun.jdi.Method getReflectionFactoryMethod = ClassTypeWrapper.concreteMethodByName(
reflectionFactoryType, "getReflectionFactory", "()Lsun/reflect/ReflectionFactory;");
if (getReflectionFactoryMethod == null) {
throw new InvalidObjectException("Reflection Factory getter not found.");
}
ClassType objectClassType = (ClassType) getOrLoadClass(vm, "java.lang.Object");
if (objectClassType == null) {
throw new InvalidObjectException("No Object class found in the target VM.");
}
ClassObjectReference objectClass = ReferenceTypeWrapper.classObject(objectClassType);
com.sun.jdi.Method getDeclaredConstructorMethod = ClassTypeWrapper.concreteMethodByName(
((ClassType) ObjectReferenceWrapper.referenceType(objectClass)),
"getDeclaredConstructor", "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;");
if (getDeclaredConstructorMethod == null) {
throw new InvalidObjectException("getDeclaredConstructor() method not found on Object class. Can not create a new instance.");
}
com.sun.jdi.Method newConstructorForSerializationMethod = ClassTypeWrapper.concreteMethodByName(
reflectionFactoryType,
"newConstructorForSerialization",
"(Ljava/lang/Class;Ljava/lang/reflect/Constructor;)Ljava/lang/reflect/Constructor;");
if (newConstructorForSerializationMethod == null) {
throw new InvalidObjectException("newConstructorForSerialization() method not found on Object class. Can not create a new instance.");
}
ObjectReference objectConstructor = (ObjectReference)
ObjectReferenceWrapper.invokeMethod(objectClass, thread,
getDeclaredConstructorMethod,
Collections.EMPTY_LIST,
ClassType.INVOKE_SINGLE_THREADED);
ObjectReference rf = (ObjectReference)
ClassTypeWrapper.invokeMethod(reflectionFactoryType, thread,
getReflectionFactoryMethod,
Collections.EMPTY_LIST,
ClassType.INVOKE_SINGLE_THREADED);
ObjectReference constructor = (ObjectReference)
ObjectReferenceWrapper.invokeMethod(rf, thread,
newConstructorForSerializationMethod,
Arrays.asList(new Value[] {
ReferenceTypeWrapper.classObject(type),
objectConstructor }),
ClassType.INVOKE_SINGLE_THREADED);
// Object newInstance = constructor.newInstance();
com.sun.jdi.Method newInstanceMethod = ClassTypeWrapper.concreteMethodByName(
((ClassType) ObjectReferenceWrapper.referenceType(constructor)),
"newInstance", "([Ljava/lang/Object;)Ljava/lang/Object;");
if (newInstanceMethod == null) {
throw new InvalidObjectException("newInstance() method not found on Constructor class. Can not create a new instance.");
}
ObjectReference newInstance = (ObjectReference)
ObjectReferenceWrapper.invokeMethod(constructor, thread,
newInstanceMethod,
Collections.EMPTY_LIST,
ClassType.INVOKE_SINGLE_THREADED);
return newInstance;
} else {
return ClassTypeWrapper.newInstance(type, thread, c, Collections.EMPTY_LIST, ClassType.INVOKE_SINGLE_THREADED);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:71,代码来源:VariableMirrorTranslator.java
示例19: classObject
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
@Override
public ClassObjectReference classObject() {
return types[0].classObject();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:EvaluatorVisitor.java
示例20: getPrefix
import com.sun.jdi.ClassObjectReference; //导入依赖的package包/类
@Override
protected String getPrefix(ObjectReference value, Map<String, Object> options) {
Type classType = ((ClassObjectReference) value).reflectedType();
return String.format("%s (%s)", super.getPrefix(value, options),
typeToStringFunction.apply(classType, options));
}
开发者ID:Microsoft,项目名称:java-debug,代码行数:7,代码来源:ClassObjectFormatter.java
注:本文中的com.sun.jdi.ClassObjectReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论