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; }
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); } }
public ClassLoaderReference classLoader() { if (ref() instanceof TypeArrayKlass) { // primitive array klasses are loaded by bootstrap loader return null; } else { Klass bottomKlass = ((ObjArrayKlass)ref()).getBottomKlass(); if (bottomKlass instanceof TypeArrayKlass) { // multidimensional primitive array klasses are loaded by bootstrap loader return null; } else { // class loader of any other obj array klass is same as the loader // that loaded the bottom InstanceKlass Instance xx = (Instance)(((InstanceKlass) bottomKlass).getClassLoader()); return vm.classLoaderMirror(xx); } } }
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); } }
@Override public ObjectVariable getClassLoader() { ClassLoaderReference cl; try { cl = ReferenceTypeWrapper.classLoader(classType); } catch (InternalExceptionWrapper | ObjectCollectedExceptionWrapper | VMDisconnectedExceptionWrapper ex) { cl = null; } return new AbstractObjectVariable(debugger, cl, "Loader "+getName()); }
public List<ReferenceType> visibleClasses() { List<ReferenceType> classes = null; try { Cache local = (Cache)getCache(); if (local != null) { classes = local.visibleClasses; } if (classes == null) { JDWP.ClassLoaderReference.VisibleClasses.ClassInfo[] jdwpClasses = JDWP.ClassLoaderReference.VisibleClasses. process(vm, this).classes; classes = new ArrayList<>(jdwpClasses.length); for (int i = 0; i < jdwpClasses.length; ++i) { classes.add(vm.referenceType(jdwpClasses[i].typeID, jdwpClasses[i].refTypeTag)); } classes = Collections.unmodifiableList(classes); if (local != null) { local.visibleClasses = classes; if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace(description() + " temporarily caching visible classes (count = " + classes.size() + ")"); } } } } catch (JDWPException exc) { throw exc.toJDIException(); } return classes; }
public ClassLoaderReference classLoader() { if (!isClassLoaderCached) { // Does not need synchronization, since worst-case // static info is fetched twice try { classLoader = JDWP.ReferenceType.ClassLoader. process(vm, this).classLoader; isClassLoaderCached = true; } catch (JDWPException exc) { throw exc.toJDIException(); } } return classLoader; }
public synchronized ClassLoaderReference classLoader() { if (cachedClassLoader) { return classLoader; } try { classLoader = JDWP.ModuleReference.ClassLoader. process(this.vm, this).classLoader; cachedClassLoader = true; } catch (JDWPException ex) { throw ex.toJDIException(); } return classLoader; }
@Nullable @Override public ClassLoaderReference getClassLoader() throws EvaluateException { DebuggerManagerThreadImpl.assertIsManagerThread(); if (myClassLoader != null) { return myClassLoader; } return myFrameProxy != null ? myFrameProxy.getClassLoader() : null; }
@Override public Value evaluate(final EvaluationContext evaluationContext) throws EvaluateException { DebugProcess process = evaluationContext.getDebugProcess(); ClassLoaderReference classLoader = ClassLoadingUtils.getClassLoader(evaluationContext, process); String version = ((VirtualMachineProxyImpl)process.getVirtualMachineProxy()).version(); Collection<ClassObject> classes = compile(JdkVersionUtil.getVersion(version)); defineClasses(classes, evaluationContext, process, classLoader); try { // invoke base evaluator on call code final Project project = ApplicationManager.getApplication().runReadAction(new Computable<Project>() { @Override public Project compute() { return myPsiContext.getProject(); } }); ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(project, new EvaluatingComputable<ExpressionEvaluator>() { @Override public ExpressionEvaluator compute() throws EvaluateException { final TextWithImports callCode = getCallCode(); PsiElement copyContext = myData.getAnchor(); final CodeFragmentFactory factory = DebuggerUtilsEx.findAppropriateCodeFragmentFactory(callCode, copyContext); return factory.getEvaluatorBuilder(). build(factory.createCodeFragment(callCode, copyContext, project), ContextUtil.getSourcePosition(evaluationContext)); } }); ((EvaluationContextImpl)evaluationContext).setClassLoader(classLoader); return evaluator.evaluate(evaluationContext); } catch (Exception e) { throw new EvaluateException("Error during generated code invocation " + e, e); } }
private ClassType defineClasses(Collection<ClassObject> classes, EvaluationContext context, DebugProcess process, ClassLoaderReference classLoader) throws EvaluateException { for (ClassObject cls : classes) { if (cls.getPath().contains(GEN_CLASS_NAME)) { final byte[] content = cls.getContent(); if (content != null) { final byte[] bytes = changeSuperToMagicAccessor(content); ClassLoadingUtils.defineClass(cls.getClassName(), bytes, context, process, classLoader); } } } return (ClassType)process.findClass(context, getGenClassQName(), classLoader); }
@Override public ClassLoaderReference classLoader() { return types[0].classLoader(); }
public ClassLoaderReference classLoader() { Instance xx = (Instance)(((InstanceKlass)saKlass).getClassLoader()); return (ClassLoaderReferenceImpl)vm.classLoaderMirror(xx); }
@Nullable ClassLoaderReference getClassLoader() throws EvaluateException;
public void setClassLoader(ClassLoaderReference classLoader) { myClassLoader = classLoader; }
public static F3ClassLoaderReference wrap(F3VirtualMachine f3vm, ClassLoaderReference ref) { return (ref == null)? null : f3vm.classLoaderReference(ref); }
public ClassLoaderReference classLoader() { return F3Wrapper.wrap(virtualMachine(), underlying().classLoader()); }
protected F3ClassLoaderReference classLoaderReference(ClassLoaderReference clref) { return new F3ClassLoaderReference(this, clref); }
public F3ClassLoaderReference(F3VirtualMachine f3vm, ClassLoaderReference underlying) { super(f3vm, underlying); }
@Override protected ClassLoaderReference underlying() { return (ClassLoaderReference) super.underlying(); }
public ClassLoaderReference getClassLoader() throws EvaluateException { DebuggerManagerThreadImpl.assertIsManagerThread(); return myFrameProxy != null ? myFrameProxy.getClassLoader() : null; }
ClassLoaderReference getClassLoader() throws EvaluateException;