• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PrimitiveType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.jdi.PrimitiveType的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveType类的具体用法?Java PrimitiveType怎么用?Java PrimitiveType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PrimitiveType类属于com.sun.jdi包,在下文中一共展示了PrimitiveType类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: adjustBoxingType

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
public static ReferenceType adjustBoxingType(ReferenceType type, PrimitiveType primitiveType,
                                              EvaluationContext evaluationContext) {
    Class typeClass = null;
    if (primitiveType instanceof BooleanType) {
        typeClass = Boolean.class;
    } else
    if (primitiveType instanceof ByteType) {
        typeClass = Byte.class;
    } else
    if (primitiveType instanceof CharType) {
        typeClass = Character.class;
    } else
    if (primitiveType instanceof ShortType) {
        typeClass = Short.class;
    } else
    if (primitiveType instanceof IntegerType) {
        typeClass = Integer.class;
    } else
    if (primitiveType instanceof LongType) {
        typeClass = Long.class;
    } else
    if (primitiveType instanceof FloatType) {
        typeClass = Float.class;
    } else
    if (primitiveType instanceof DoubleType) {
        typeClass = Double.class;
    }
    if (typeClass != null) {
        type = evaluationContext.getVMCache().getClass(typeClass.getName());
    }
    return type;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:EvaluatorVisitor.java


示例2: extendsType

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
/** @return true if t2 is an extension of t1 */
private static boolean extendsType(PrimitiveType t1, PrimitiveType t2) {
    // BooleanType, ByteType and CharType can be matched together only.
    if (t2 instanceof ShortType) {
        return t2 instanceof ByteType || t2 instanceof ShortType;
    }
    if (t2 instanceof IntegerType) {
        return t2 instanceof ByteType || t2 instanceof ShortType || t2 instanceof IntegerType;
    }
    if (t2 instanceof LongType) {
        return t2 instanceof ByteType || t2 instanceof ShortType ||
               t2 instanceof IntegerType || t2 instanceof LongType;
    }
    if (t2 instanceof FloatType) {
        return !(t2 instanceof BooleanType || t2 instanceof CharType || t2 instanceof DoubleType);
    }
    if (t2 instanceof DoubleType) {
        return !(t2 instanceof BooleanType || t2 instanceof CharType);
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:EvaluatorVisitor.java


示例3: autoboxArguments

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
/**
 * Auto-boxes or un-boxes arguments of a method.
 */
static void autoboxArguments(List<Type> types, List<Value> argVals,
                             ThreadReference evaluationThread,
                             EvaluationContext evaluationContext) throws InvalidTypeException,
                                                                         ClassNotLoadedException,
                                                                         IncompatibleThreadStateException,
                                                                         InvocationException {
    if (types.size() != argVals.size()) {
        return ;
    }
    int n = types.size();
    for (int i = 0; i < n; i++) {
        Type t = types.get(i);
        Value v = argVals.get(i);
        if (v instanceof ObjectReference && t instanceof PrimitiveType) {
            argVals.set(i, unbox((ObjectReference) v, (PrimitiveType) t, evaluationThread, evaluationContext));
        }
        if (v instanceof PrimitiveValue && t instanceof ReferenceType) {
            argVals.set(i, box((PrimitiveValue) v, (ReferenceType) t, evaluationThread, evaluationContext));
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:EvaluatorVisitor.java


示例4: primitiveTypeMirror

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
PrimitiveType primitiveTypeMirror(byte tag) {
    switch (tag) {
        case JDWP.Tag.BOOLEAN:
            return theBooleanType();
        case JDWP.Tag.BYTE:
            return theByteType();
        case JDWP.Tag.CHAR:
            return theCharType();
        case JDWP.Tag.SHORT:
            return theShortType();
        case JDWP.Tag.INT:
            return theIntegerType();
        case JDWP.Tag.LONG:
            return theLongType();
        case JDWP.Tag.FLOAT:
            return theFloatType();
        case JDWP.Tag.DOUBLE:
            return theDoubleType();
        default:
            throw new IllegalArgumentException("Unrecognized primitive tag " + tag);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:VirtualMachineImpl.java


示例5: isComponentAssignable

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
static boolean isComponentAssignable(Type destination, Type source) {
    if (source instanceof PrimitiveType) {
        // Assignment of primitive arrays requires identical
        // component types.
        return source.equals(destination);
    } else {
        if (destination instanceof PrimitiveType) {
            return false;
        }

        ReferenceTypeImpl refSource = (ReferenceTypeImpl)source;
        ReferenceTypeImpl refDestination = (ReferenceTypeImpl)destination;
        // Assignment of object arrays requires availability
        // of widening conversion of component types
        return refSource.isAssignableTo(refDestination);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:ArrayTypeImpl.java


示例6: isComponentAssignable

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
static boolean isComponentAssignable(Type destination, Type source) {
    if (source instanceof PrimitiveType) {
        // Assignment of primitive arrays requires identical
        // component types.
        return source.equals(destination);
    } else {
       if (destination instanceof PrimitiveType) {
            return false;
        }

        ReferenceTypeImpl refSource = (ReferenceTypeImpl)source;
        ReferenceTypeImpl refDestination = (ReferenceTypeImpl)destination;
        // Assignment of object arrays requires availability
        // of widening conversion of component types
        return refSource.isAssignableTo(refDestination);
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:18,代码来源:ArrayTypeImpl.java


示例7: getModifiers

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
int getModifiers() {
    /*
     * For object arrays, the return values for Interface
     * Accessible.isPrivate(), Accessible.isProtected(),
     * etc... are the same as would be returned for the
     * component type.  Fetch the modifier bits from the
     * component type and use those.
     *
     * For primitive arrays, the modifiers are always
     *   VMModifiers.FINAL | VMModifiers.PUBLIC
     *
     * Reference com.sun.jdi.Accessible.java.
     */
    try {
        Type t = componentType();
        if (t instanceof PrimitiveType) {
            return VMModifiers.FINAL | VMModifiers.PUBLIC;
        } else {
            ReferenceType rt = (ReferenceType)t;
            return rt.modifiers();
        }
    } catch (ClassNotLoadedException cnle) {
        cnle.printStackTrace();
    }
    return -1;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:27,代码来源:ArrayTypeImpl.java


示例8: resolvePrimitive

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
private IValue resolvePrimitive(final com.sun.jdi.Value value)
{
  if (value == null)
  {
    return valueFactory().createNullValue();
  }
  final com.sun.jdi.Type t = value.type();
  if (t instanceof PrimitiveType)
  {
    if (t instanceof CharType)
    {
      return valueFactory().createPrimitiveValue(escapeStringValue(value.toString()));
    }
    return valueFactory().createPrimitiveValue(value.toString());
  }
  return null;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:18,代码来源:EventFactoryAdapter.java


示例9: setValueToFinalField

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
private static void setValueToFinalField(ObjectReference obj, String name, ClassType clazz, Value fv, VirtualMachine vm, ThreadReference thread) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ClassNotPreparedExceptionWrapper, ClassNotLoadedException, ObjectCollectedExceptionWrapper, IncompatibleThreadStateException, UnsupportedOperationExceptionWrapper, InvalidTypeException, InvalidObjectException {
    ObjectReference fieldRef = getDeclaredOrInheritedField(clazz, name, vm, thread);
    if (fieldRef == null) {
        InvalidObjectException ioex = new InvalidObjectException("No field "+name+" of class "+clazz);
        throw ioex;
    }
    // field.setAccessible(true);
    ClassType fieldClassType = (ClassType) ValueWrapper.type(fieldRef);
    com.sun.jdi.Method setAccessibleMethod = ClassTypeWrapper.concreteMethodByName(
            fieldClassType, "setAccessible", "(Z)V");
    try {
        ObjectReferenceWrapper.invokeMethod(fieldRef, thread, setAccessibleMethod,
                                            Collections.singletonList(vm.mirrorOf(true)),
                                            ClassType.INVOKE_SINGLE_THREADED);
        // field.set(newInstance, fv);
        com.sun.jdi.Method setMethod = ClassTypeWrapper.concreteMethodByName(
                fieldClassType, "set", "(Ljava/lang/Object;Ljava/lang/Object;)V");
        if (fv instanceof PrimitiveValue) {
            PrimitiveType pt = (PrimitiveType) ValueWrapper.type(fv);
            ReferenceType fieldBoxingClass = EvaluatorVisitor.adjustBoxingType(clazz, pt, null);
            fv = EvaluatorVisitor.box((PrimitiveValue) fv, fieldBoxingClass, thread, null);
        }
        List<Value> args = Arrays.asList(new Value[] { obj, fv });
        ObjectReferenceWrapper.invokeMethod(fieldRef, thread, setMethod,
                                            args,
                                            ClassType.INVOKE_SINGLE_THREADED);
    } catch (InvocationException iex) {
        throw new InvalidObjectException(
                "Problem setting value "+fv+" to field "+name+" of class "+clazz+
                " : "+iex.exception());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:VariableMirrorTranslator.java


示例10: toString

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
private String toString(Tree arg0, Mirror v, EvaluationContext evaluationContext) {
    if (v instanceof PrimitiveValue) {
        PrimitiveValue pv = (PrimitiveValue) v;
        PrimitiveType t = (PrimitiveType) pv.type();
        if (t instanceof ByteType) {
            return Byte.toString(pv.byteValue());
        }
        if (t instanceof BooleanType) {
            return Boolean.toString(pv.booleanValue());
        }
        if (t instanceof CharType) {
            return Character.toString(pv.charValue());
        }
        if (t instanceof ShortType) {
            return Short.toString(pv.shortValue());
        }
        if (t instanceof IntegerType) {
            return Integer.toString(pv.intValue());
        }
        if (t instanceof LongType) {
            return Long.toString(pv.longValue());
        }
        if (t instanceof FloatType) {
            return Float.toString(pv.floatValue());
        }
        if (t instanceof DoubleType) {
            return Double.toString(pv.doubleValue());
        }
        throw new IllegalStateException("Unknown primitive type: "+t);
    }
    if (v == null) {
        return "" + null;
    }
    ObjectReference ov = (ObjectReference) v;
    if (ov instanceof ArrayReference) {
        return "#" + ov.uniqueID() +
            " " + ov.type().name() +
            "(length=" + ((ArrayReference) ov).length() + ")";
    }
    if (ov instanceof StringReference) {
        return ((StringReference) ov).value();
    }
    // Call toString() method:
    List<? extends TypeMirror> typeArguments = Collections.emptyList();
    Method method;
    try {
        method = getConcreteMethod((ReferenceType) ov.type(), "toString", typeArguments);
    } catch (UnsuitableArgumentsException uaex) {
        throw new IllegalStateException(uaex);
    }
    ((ClassType) ov.type()).methodsByName("toString");
    List<Value> argVals = Collections.emptyList();
    Value sv = invokeMethod(arg0, method, false, null, ov, argVals, evaluationContext, false);
    if (sv instanceof StringReference) {
        return ((StringReference) sv).value();
    } else if (sv == null) {
        return null;
    } else {
        return "Result of toString() call on "+ov+" is not a String, but: "+sv; // NOI18N - should not ever happen.
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:62,代码来源:EvaluatorVisitor.java


示例11: getModifiers

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
void getModifiers() {
    if (modifiers != -1) {
        return;
    }
    /*
     * For object arrays, the return values for Interface
     * Accessible.isPrivate(), Accessible.isProtected(),
     * etc... are the same as would be returned for the
     * component type.  Fetch the modifier bits from the
     * component type and use those.
     *
     * For primitive arrays, the modifiers are always
     *   VMModifiers.FINAL | VMModifiers.PUBLIC
     *
     * Reference com.sun.jdi.Accessible.java.
     */
    try {
        Type t = componentType();
        if (t instanceof PrimitiveType) {
            modifiers = VMModifiers.FINAL | VMModifiers.PUBLIC;
        } else {
            ReferenceType rt = (ReferenceType)t;
            modifiers = rt.modifiers();
        }
    } catch (ClassNotLoadedException cnle) {
        cnle.printStackTrace();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:ArrayTypeImpl.java


示例12: wrap

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
public static F3Type wrap(F3VirtualMachine f3vm, Type type) {
    if (type == null) {
        return null;
    }
    
    if (type instanceof VoidType) {
        return f3vm.voidType((VoidType)type);
    } else if (type instanceof PrimitiveType) {
        if (type instanceof BooleanType) {
            return f3vm.booleanType((BooleanType)type);
        } else if (type instanceof CharType) {
            return f3vm.charType((CharType)type);
        } else if (type instanceof ByteType) {
            return f3vm.byteType((ByteType)type);
        } else if (type instanceof ShortType) {
            return f3vm.shortType((ShortType)type);
        } else if (type instanceof IntegerType) {
            return f3vm.integerType((IntegerType)type);
        } else if (type instanceof LongType) {
            return f3vm.longType((LongType)type);
        } else if (type instanceof FloatType) {
            return f3vm.floatType((FloatType)type);
        } else if (type instanceof DoubleType) {
            return f3vm.doubleType((DoubleType)type);
        } else {
            throw new IllegalArgumentException("illegal primitive type : " + type);
        }
    } else if (type instanceof ReferenceType) {
        return wrap(f3vm, (ReferenceType)type);
    } else {
        throw new IllegalArgumentException("illegal type: " + type);
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:34,代码来源:F3Wrapper.java


示例13: createArrayController

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
/**
 * Factory method
 * 
 * @param parent
 *            the parent SWT composite in which the view of this controller
 *            should be created
 * @param history
 *            the actual history
 * @return created {@link AbstractHistoryController}
 */
public AbstractArrayController createArrayController(
		final Composite parent,
		final ArrayExpression exp, final FieldImpl field) {
	final AbstractArrayController newController;
	if (exp.getType(field) instanceof PrimitiveType) {
		switch (mode) {
		case ArraysMainController.MODE_SERIES:
			newController = new NumericArrayController(parent, exp, field, properties);
			break;
		case ArraysMainController.MODE_HISTOGRAM:
			newController = new BarChartArrayController(parent, exp, field, properties);
			break;
		default:
			newController = null;					
		}
	}
	else {
		newController = new NonNumericArrayController(parent, exp, field, properties);
	}
	if (newController != null) {
		historyControllers.add(newController);			
		newController.getView().getBtnClose().addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {					
				historyControllers.remove(newController);
				adjustWidth();
			}
		});
	}
	return newController;
}
 
开发者ID:bilalsal,项目名称:EclipseTracer,代码行数:42,代码来源:ArrayViewsManager.java


示例14: unbox

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
public static Value unbox(ObjectReference val, PrimitiveType type,
                          ThreadReference thread,
                          EvaluationContext context) throws InvalidTypeException,
                                                            ClassNotLoadedException,
                                                            IncompatibleThreadStateException,
                                                            InvocationException {
    ReferenceType rt = val.referenceType();
    String classType = rt.name();
    PrimitiveValue pv;
    if (classType.equals("java.lang.Boolean")) {
        pv = invokeUnboxingMethod(val, "booleanValue", thread, context);
    } else if (classType.equals("java.lang.Byte")) {
        pv = invokeUnboxingMethod(val, "byteValue", thread, context);
    } else if (classType.equals("java.lang.Character")) {
        pv = invokeUnboxingMethod(val, "charValue", thread, context);
    } else if (classType.equals("java.lang.Short")) {
        pv = invokeUnboxingMethod(val, "shortValue", thread, context);
    } else if (classType.equals("java.lang.Integer")) {
        pv = invokeUnboxingMethod(val, "intValue", thread, context);
    } else if (classType.equals("java.lang.Long")) {
        pv = invokeUnboxingMethod(val, "longValue", thread, context);
    } else if (classType.equals("java.lang.Float")) {
        pv = invokeUnboxingMethod(val, "floatValue", thread, context);
    } else if (classType.equals("java.lang.Double")) {
        pv = invokeUnboxingMethod(val, "doubleValue", thread, context);
    //throw new RuntimeException("Invalid type while unboxing: " + type.signature());    // never happens
    } else {
        return val;
    }
    VirtualMachine vm = pv.virtualMachine();
    if (type instanceof BooleanType && !(pv instanceof BooleanValue)) {
        return vm.mirrorOf(pv.booleanValue());
    }
    if (type instanceof ByteType && !(pv instanceof ByteValue)) {
        return vm.mirrorOf(pv.byteValue());
    }
    if (type instanceof CharType && !(pv instanceof CharValue)) {
        return vm.mirrorOf(pv.charValue());
    }
    if (type instanceof ShortType && !(pv instanceof ShortValue)) {
        return vm.mirrorOf(pv.shortValue());
    }
    if (type instanceof IntegerType && !(pv instanceof IntegerValue)) {
        return vm.mirrorOf(pv.intValue());
    }
    if (type instanceof LongType && !(pv instanceof LongValue)) {
        return vm.mirrorOf(pv.longValue());
    }
    if (type instanceof FloatType && !(pv instanceof FloatValue)) {
        return vm.mirrorOf(pv.floatValue());
    }
    if (type instanceof DoubleType && !(pv instanceof DoubleValue)) {
        return vm.mirrorOf(pv.doubleValue());
    }
    return pv;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:57,代码来源:EvaluatorVisitor.java


示例15: F3PrimitiveType

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
public F3PrimitiveType(F3VirtualMachine f3vm, PrimitiveType underlying) {
    super(f3vm, underlying);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:F3PrimitiveType.java


示例16: underlying

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
@Override
protected PrimitiveType underlying() {
    return (PrimitiveType) super.underlying();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:F3PrimitiveType.java


示例17: isPrimitiveType

import com.sun.jdi.PrimitiveType; //导入依赖的package包/类
/***
 * 
 * @return true if the {@link Type} returned by {@link #getJavaType()} is a {@link PrimitiveType}
 */
public boolean isPrimitiveType() {
	return getJavaType() instanceof PrimitiveType;
}
 
开发者ID:bilalsal,项目名称:EclipseTracer,代码行数:8,代码来源:Watchpoint.java



注:本文中的com.sun.jdi.PrimitiveType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Base64类代码示例发布时间:2022-05-23
下一篇:
Java SyndEnclosureImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap