本文整理汇总了Java中com.sun.jdi.TypeComponent类的典型用法代码示例。如果您正苦于以下问题:Java TypeComponent类的具体用法?Java TypeComponent怎么用?Java TypeComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeComponent类属于com.sun.jdi包,在下文中一共展示了TypeComponent类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFieldValueWithConflict
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
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);
}
示例2: isSynthetic
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
@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("$");
}
}
示例3: listStaticVariables
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
/**
* 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;
}
示例4: hasBlueprintProtectionDomain
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
private static boolean hasBlueprintProtectionDomain(ObjectReference context) {
return context
.referenceType()
.allFields()
.stream()
.map(TypeComponent::name)
.anyMatch("bundleContext"::equals);
}
示例5: hasBundleProtectionDomain
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
private static boolean hasBundleProtectionDomain(ObjectReference context) {
return context
.referenceType()
.allFields()
.stream()
.map(TypeComponent::name)
.anyMatch("bundle"::equals);
}
示例6: getWeight
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
@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));
}
示例7: getWeight
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
@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;
}
示例8: F3TypeComponent
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
public F3TypeComponent(F3VirtualMachine f3vm, TypeComponent underlying) {
super(f3vm, underlying);
}
示例9: underlying
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
@Override
protected TypeComponent underlying() {
return (TypeComponent) super.underlying();
}
示例10: createModifiers
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
/**
* 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;
}
示例11: createVisibility
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
private NodeVisibility createVisibility(final TypeComponent member)
{
return member.isPackagePrivate() ? NV_PACKAGE : member.isPrivate() ? NV_PRIVATE : member
.isProtected() ? NV_PROTECTED : NV_PUBLIC;
}
示例12: isSynthetic
import com.sun.jdi.TypeComponent; //导入依赖的package包/类
boolean isSynthetic(TypeComponent typeComponent);