Java 类com.sun.jdi.ClassLoaderReference 实例源码

项目:incubator-netbeans    文件:RemoteServices.java   
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;
}
项目:openjdk-jdk10    文件:ArrayTypeImpl.java   
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);
    }
}
项目:openjdk9    文件:ArrayTypeImpl.java   
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);
        }
    }
}
项目:form-follows-function    文件:F3Wrapper.java   
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);
    }
}
项目:incubator-netbeans    文件:JPDAClassTypeImpl.java   
@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());
}
项目:openjdk-jdk10    文件:ClassLoaderReferenceImpl.java   
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;
}
项目:openjdk-jdk10    文件:ReferenceTypeImpl.java   
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;
}
项目:openjdk-jdk10    文件:ModuleReferenceImpl.java   
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;
}
项目:intellij-ce-playground    文件:EvaluationContextImpl.java   
@Nullable
@Override
public ClassLoaderReference getClassLoader() throws EvaluateException {
  DebuggerManagerThreadImpl.assertIsManagerThread();
  if (myClassLoader != null) {
    return myClassLoader;
  }
  return myFrameProxy != null ? myFrameProxy.getClassLoader() : null;
}
项目:intellij-ce-playground    文件:CompilingEvaluator.java   
@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);
  }
}
项目:intellij-ce-playground    文件:CompilingEvaluator.java   
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);
}
项目:incubator-netbeans    文件:EvaluatorVisitor.java   
@Override
public ClassLoaderReference classLoader() {
    return types[0].classLoader();
}
项目:openjdk9    文件:ReferenceTypeImpl.java   
public ClassLoaderReference classLoader() {
  Instance xx = (Instance)(((InstanceKlass)saKlass).getClassLoader());
  return (ClassLoaderReferenceImpl)vm.classLoaderMirror(xx);
}
项目:intellij-ce-playground    文件:EvaluationContext.java   
@Nullable
ClassLoaderReference getClassLoader() throws EvaluateException;
项目:intellij-ce-playground    文件:EvaluationContextImpl.java   
public void setClassLoader(ClassLoaderReference classLoader) {
  myClassLoader = classLoader;
}
项目:form-follows-function    文件:F3Wrapper.java   
public static F3ClassLoaderReference wrap(F3VirtualMachine f3vm, ClassLoaderReference ref) {
    return (ref == null)? null : f3vm.classLoaderReference(ref);
}
项目:form-follows-function    文件:F3ReferenceType.java   
public ClassLoaderReference classLoader() {
    return F3Wrapper.wrap(virtualMachine(), underlying().classLoader());
}
项目:form-follows-function    文件:F3VirtualMachine.java   
protected F3ClassLoaderReference classLoaderReference(ClassLoaderReference clref) {
    return new F3ClassLoaderReference(this, clref);
}
项目:form-follows-function    文件:F3ClassLoaderReference.java   
public F3ClassLoaderReference(F3VirtualMachine f3vm, ClassLoaderReference underlying) {
    super(f3vm, underlying);
}
项目:form-follows-function    文件:F3ClassLoaderReference.java   
@Override
protected ClassLoaderReference underlying() {
    return (ClassLoaderReference) super.underlying();
}
项目:tools-idea    文件:EvaluationContextImpl.java   
public ClassLoaderReference getClassLoader() throws EvaluateException {
  DebuggerManagerThreadImpl.assertIsManagerThread();
  return myFrameProxy != null ? myFrameProxy.getClassLoader() : null;
}
项目:intellij-ce-playground    文件:StackFrameProxy.java   
ClassLoaderReference getClassLoader() throws EvaluateException;
项目:tools-idea    文件:EvaluationContext.java   
ClassLoaderReference getClassLoader() throws EvaluateException;
项目:tools-idea    文件:StackFrameProxy.java   
ClassLoaderReference getClassLoader() throws EvaluateException;