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

项目:java-debug    文件:SetVariableRequestHandler.java   
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);
}
项目:intellij-ce-playground    文件:DefaultSyntheticProvider.java   
@Override
public boolean isSynthetic(TypeComponent typeComponent) {
  String name = typeComponent.name();
  if (LambdaMethodFilter.isLambdaName(name)) {
    return false;
  }
  else {
    ReferenceType type = typeComponent.declaringType();
    if (type.name().contains("$$Lambda$")) {
      return true;
    }
  }
  VirtualMachine machine = typeComponent.virtualMachine();
  if (machine != null && machine.canGetSyntheticAttribute()) {
    return typeComponent.isSynthetic();
  }
  else {
    return name.contains("$");
  }
}
项目:java-debug    文件:VariableUtils.java   
/**
 * Get the static variable of an stack frame.
 *
 * @param stackFrame
 *            the stack frame
 * @return the static variable of an stack frame.
 */
public static List<Variable> listStaticVariables(StackFrame stackFrame) {
    List<Variable> res = new ArrayList<>();
    ReferenceType type = stackFrame.location().declaringType();
    type.allFields().stream().filter(TypeComponent::isStatic).forEach(field -> {
        Variable staticVar = new Variable(field.name(), type.getValue(field));
        staticVar.field = field;
        res.add(staticVar);
    });
    return res;
}
项目:acdebugger    文件:BreakpointProcessor.java   
private static boolean hasBlueprintProtectionDomain(ObjectReference context) {
  return context
      .referenceType()
      .allFields()
      .stream()
      .map(TypeComponent::name)
      .anyMatch("bundleContext"::equals);
}
项目:acdebugger    文件:BreakpointProcessor.java   
private static boolean hasBundleProtectionDomain(ObjectReference context) {
  return context
      .referenceType()
      .allFields()
      .stream()
      .map(TypeComponent::name)
      .anyMatch("bundle"::equals);
}
项目:codehint    文件:MethodFieldWeightedList.java   
@Override
public double getWeight(TypeComponent comp) {
    if (comp instanceof Method)
        return ProbabilityComputer.getMethodProbability((Method)comp, weights) * getMethodFudge(((Method)comp));
    else if (comp instanceof Field)
        return ProbabilityComputer.getFieldProbability((Field)comp, weights);
    else
        throw new IllegalArgumentException(String.valueOf(comp));
}
项目:codehint    文件:StochasticExpressionGenerator.java   
@Override
public double getWeight(TypeComponent comp) {
    double weight = super.getWeight(comp);
    IJavaType type = comp instanceof Field ? EclipseUtils.getTypeAndLoadIfNeeded(((Field)comp).typeName(), stack, target, typeCache) : getReturnType(receiver, (Method)comp, ((Method)comp).isConstructor());
    try {
        weight *= getTypeFactor(type);
    } catch (DebugException e) {
        throw new RuntimeException(e);
    }
    return weight;
}
项目:form-follows-function    文件:F3TypeComponent.java   
public F3TypeComponent(F3VirtualMachine f3vm, TypeComponent underlying) {
    super(f3vm, underlying);
}
项目:form-follows-function    文件:F3TypeComponent.java   
@Override
protected TypeComponent underlying() {
    return (TypeComponent) super.underlying();
}
项目:jive    文件:StaticModelDelegateForJDI.java   
/**
 * TODO: reduce the cyclomatic complexity.
 */
private Set<NodeModifier> createModifiers(final TypeComponent member)
{
  final Set<NodeModifier> modifiers = new LinkedHashSet<NodeModifier>();
  // final
  if (member.isFinal())
  {
    modifiers.add(NM_FINAL);
  }
  // static
  if (member.isStatic())
  {
    modifiers.add(NM_STATIC);
  }
  // transient
  if (member instanceof Field && ((Field) member).isTransient())
  {
    modifiers.add(NM_TRANSIENT);
  }
  // volatile
  if (member instanceof Field && ((Field) member).isVolatile())
  {
    modifiers.add(NM_VOLATILE);
  }
  // bridge method (for covariance in generic types)
  if (member instanceof Method && ((Method) member).isBridge())
  {
    modifiers.add(NM_BRIDGE);
  }
  // constructor
  if (member instanceof Method && ((Method) member).isConstructor())
  {
    modifiers.add(NM_CONSTRUCTOR);
  }
  // compiler generated method (e.g., bridges, constructors)
  if (member instanceof Method && ((Method) member).isSynthetic())
  {
    modifiers.add(NM_SYNTHETIC);
  }
  return modifiers;
}
项目:jive    文件:StaticModelDelegateForJDI.java   
private NodeVisibility createVisibility(final TypeComponent member)
{
  return member.isPackagePrivate() ? NV_PACKAGE : member.isPrivate() ? NV_PRIVATE : member
      .isProtected() ? NV_PROTECTED : NV_PUBLIC;
}
项目:intellij-ce-playground    文件:SyntheticTypeComponentProvider.java   
boolean isSynthetic(TypeComponent typeComponent);