本文整理汇总了Java中com.sun.jdi.ClassType类的典型用法代码示例。如果您正苦于以下问题:Java ClassType类的具体用法?Java ClassType怎么用?Java ClassType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassType类属于com.sun.jdi包,在下文中一共展示了ClassType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test1
import com.sun.jdi.ClassType; //导入依赖的package包/类
@SuppressWarnings("unused") // called via reflection
private void test1() throws Exception {
System.out.println("DEBUG: ------------> Running test1");
try {
Field field = targetClass.fieldByName("fooCls");
ClassType clsType = (ClassType)field.type();
Method constructor = getConstructorForClass(clsType);
for (int i = 0; i < 15; i++) {
@SuppressWarnings({ "rawtypes", "unchecked" })
ObjectReference objRef = clsType.newInstance(mainThread,
constructor,
new ArrayList(0),
ObjectReference.INVOKE_NONVIRTUAL);
if (objRef.isCollected()) {
System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
continue;
}
invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
}
} catch (InvocationException e) {
handleFailure(e);
}
}
示例2: allMethods
import com.sun.jdi.ClassType; //导入依赖的package包/类
/**
* Shared implementation of {@linkplain ClassType#allMethods()} and
* {@linkplain InterfaceType#allMethods()}
* @return A list of all methods (recursively)
*/
public final List<Method> allMethods() {
ArrayList<Method> list = new ArrayList<>(methods());
ClassType clazz = superclass();
while (clazz != null) {
list.addAll(clazz.methods());
clazz = clazz.superclass();
}
/*
* Avoid duplicate checking on each method by iterating through
* duplicate-free allInterfaces() rather than recursing
*/
for (InterfaceType interfaze : getAllInterfaces()) {
list.addAll(interfaze.methods());
}
return list;
}
示例3: isF3Type
import com.sun.jdi.ClassType; //导入依赖的package包/类
/**
* JDI addition: Determines if this is a F3 class.
*
* @return <code>true</code> if this is a F3 class; false otherwise.
*/
@Override
public boolean isF3Type() {
if (!isIsF3TypeSet) {
isIsF3TypeSet = true;
F3VirtualMachine f3vm = virtualMachine();
InterfaceType f3ObjType = (InterfaceType) F3Wrapper.unwrap(f3vm.f3ObjectType());
if (f3ObjType != null) {
ClassType thisType = underlying();
List<InterfaceType> allIfaces = thisType.allInterfaces();
for (InterfaceType iface : allIfaces) {
if (iface.equals(f3ObjType)) {
isF3Type = true;
break;
}
}
}
}
return isF3Type;
}
示例4: handleClassLoad
import com.sun.jdi.ClassType; //导入依赖的package包/类
private void handleClassLoad(final ClassType classType, final ThreadReference thread)
{
// do not proceed if this part of the hierarchy has been processed
if (contourFactory().lookupStaticContour(classType.name()) == null)
{
// update the meta-data for this type and all other types in its file
resolveType(classType);
// handle the super class
final ClassType superClass = classType.superclass();
// if a class is in-model, all its ancestors must be in-model so that the proper static
// contours and their members exist
if (superClass != null)
{
handleClassLoad(superClass, thread);
}
// Only static and top-level types have static contours, *including* nested static types.
if (classType.isStatic() || !isNestedType(classType))
{
// creates and dispatches a type load event for this type
manager().jiveDispatcher().dispatchLoadEvent(classType, thread);
}
}
}
示例5: ungrabWindowAWT
import com.sun.jdi.ClassType; //导入依赖的package包/类
private boolean ungrabWindowAWT(ThreadReference tr, ObjectReference grabbedWindow) {
// Call XBaseWindow.ungrabInput()
try {
VirtualMachine vm = MirrorWrapper.virtualMachine(grabbedWindow);
List<ReferenceType> xbaseWindowClassesByName = VirtualMachineWrapper.classesByName(vm, "sun.awt.X11.XBaseWindow");
if (xbaseWindowClassesByName.isEmpty()) {
logger.info("Unable to release X grab, no XBaseWindow class in target VM "+VirtualMachineWrapper.description(vm));
return false;
}
ClassType XBaseWindowClass = (ClassType) xbaseWindowClassesByName.get(0);
Method ungrabInput = XBaseWindowClass.concreteMethodByName("ungrabInput", "()V");
if (ungrabInput == null) {
logger.info("Unable to release X grab, method ungrabInput not found in target VM "+VirtualMachineWrapper.description(vm));
return false;
}
XBaseWindowClass.invokeMethod(tr, ungrabInput, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
} catch (VMDisconnectedExceptionWrapper vmdex) {
return true; // Disconnected, all is good.
} catch (Exception ex) {
logger.log(Level.INFO, "Unable to release X grab.", ex);
return false;
}
return true;
}
示例6: getQuantumTookitClassLoader
import com.sun.jdi.ClassType; //导入依赖的package包/类
private static ObjectReference getQuantumTookitClassLoader(VirtualMachine vm) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper {
ClassType classQuantumToolkit = getClass(vm, "com.sun.javafx.tk.quantum.QuantumToolkit");
if (classQuantumToolkit == null) {
return null;
}
ClassLoaderReference cl = ReferenceTypeWrapper.classLoader(classQuantumToolkit);
return cl;
}
示例7: stopDebuggerRemoteService
import com.sun.jdi.ClassType; //导入依赖的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);
}
}
示例8: hasAllInterfaces
import com.sun.jdi.ClassType; //导入依赖的package包/类
public boolean hasAllInterfaces(ClassType ct) {
List allInterfaces;
synchronized (allInterfacesMap) {
allInterfaces = allInterfacesMap.get(ct);
}
if (allInterfaces == null) {
return false;
} else {
synchronized (allInterfaces) {
if (allInterfaces.contains("computing")) { // NOI18N
return false;
}
}
}
return true;
}
示例9: boxType
import com.sun.jdi.ClassType; //导入依赖的package包/类
private static Type boxType(Type t) {
if (t instanceof ClassType) {
String name = ((ClassType) t).name();
if (name.equals("java.lang.Boolean")) {
t = t.virtualMachine().mirrorOf(true).type();
} else if (name.equals("java.lang.Byte")) {
t = t.virtualMachine().mirrorOf((byte) 10).type();
} else if (name.equals("java.lang.Character")) {
t = t.virtualMachine().mirrorOf('a').type();
} else if (name.equals("java.lang.Integer")) {
t = t.virtualMachine().mirrorOf(10).type();
} else if (name.equals("java.lang.Long")) {
t = t.virtualMachine().mirrorOf(10l).type();
} else if (name.equals("java.lang.Short")) {
t = t.virtualMachine().mirrorOf((short)10).type();
} else if (name.equals("java.lang.Float")) {
t = t.virtualMachine().mirrorOf(10f).type();
} else if (name.equals("java.lang.Double")) {
t = t.virtualMachine().mirrorOf(10.0).type();
}
}
return t;
}
示例10: getSuperClass
import com.sun.jdi.ClassType; //导入依赖的package包/类
@Override
public Super getSuperClass() {
if (classType instanceof ClassType) {
try {
ClassType superClass = ClassTypeWrapper.superclass((ClassType) classType);
if (superClass == null) {
return null;
} else {
return new SuperVariable(debugger, null, superClass, getName());
}
} catch (InternalExceptionWrapper | VMDisconnectedExceptionWrapper ex) {
return null;
}
} else {
return null;
}
}
示例11: hasAllTypes
import com.sun.jdi.ClassType; //导入依赖的package包/类
public boolean hasAllTypes() {
if (getInnerValue () == null) {
return true;
}
Type t;
synchronized (valueTypeLoaded) {
if (!valueTypeLoaded[0]) {
return false;
}
t = valueType;
}
if (t instanceof ClassType) {
ClassType ct = (ClassType) t;
if (!getDebugger().hasAllInterfaces(ct)) {
return false;
}
synchronized (superClassLoaded) {
if (!superClassLoaded[0]) {
return false;
}
}
}
return true;
}
示例12: getAllInterfaces
import com.sun.jdi.ClassType; //导入依赖的package包/类
public List<JPDAClassType> getAllInterfaces() {
if (getInnerValue () == null) {
return null;
}
try {
Type t = getCachedType();
if (!(t instanceof ClassType)) {
return null;
}
ClassType ct = (ClassType) t;
return getDebugger().getAllInterfaces(ct);
} catch (ObjectCollectedExceptionWrapper ocex) {
return null;
} catch (InternalExceptionWrapper ex) {
return null;
} catch (VMDisconnectedExceptionWrapper e) {
return null;
}
}
示例13: getClass
import com.sun.jdi.ClassType; //导入依赖的package包/类
private static ClassType getClass(VirtualMachine vm, String name) throws InternalExceptionWrapper,
ObjectCollectedExceptionWrapper,
VMDisconnectedExceptionWrapper {
List<ReferenceType> classList = VirtualMachineWrapper.classesByName(vm, name);
ReferenceType clazz = null;
for (ReferenceType c : classList) {
if (ReferenceTypeWrapper.classLoader(c) == null) {
clazz = c;
break;
}
}
if (clazz == null && classList.size() > 0) {
clazz = classList.get(0);
}
return (ClassType) clazz;
}
示例14: unboxType
import com.sun.jdi.ClassType; //导入依赖的package包/类
private static Type unboxType(Type t) {
if (t instanceof ClassType) {
String name = ((ClassType) t).name();
if (name.equals("java.lang.Boolean")) {
t = t.virtualMachine().mirrorOf(true).type();
} else if (name.equals("java.lang.Byte")) {
t = t.virtualMachine().mirrorOf((byte) 10).type();
} else if (name.equals("java.lang.Character")) {
t = t.virtualMachine().mirrorOf('a').type();
} else if (name.equals("java.lang.Integer")) {
t = t.virtualMachine().mirrorOf(10).type();
} else if (name.equals("java.lang.Long")) {
t = t.virtualMachine().mirrorOf(10l).type();
} else if (name.equals("java.lang.Short")) {
t = t.virtualMachine().mirrorOf((short)10).type();
} else if (name.equals("java.lang.Float")) {
t = t.virtualMachine().mirrorOf(10f).type();
} else if (name.equals("java.lang.Double")) {
t = t.virtualMachine().mirrorOf(10.0).type();
}
}
return t;
}
示例15: setValue
import com.sun.jdi.ClassType; //导入依赖的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);
}
}