本文整理汇总了Java中org.eclipse.jdt.debug.core.IJavaValue.isNull方法的典型用法代码示例。如果您正苦于以下问题:Java IJavaValue.isNull方法的具体用法?Java IJavaValue.isNull怎么用?Java IJavaValue.isNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.debug.core.IJavaValue
的用法示例。
在下文中一共展示了IJavaValue.isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extendExpression
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
/**
* Extends the given expression.
* @param expr The expression to extend.
* @param evaledExprs The set of expressions we have already evaluated.
* @param typeConstraint The type constraint.
* @param searchConstructors Whether we should search constructors.
* @param searchOperators Whether we should search operators.
* @return A new expression that extends the given expression,
* or null if the expression we tried crashes.
* @throws DebugException
* @throws JavaModelException
*/
private Expression extendExpression(Expression expr, Set<Expression> evaledExprs, TypeConstraint typeConstraint, boolean searchConstructors, boolean searchOperators) throws DebugException, JavaModelException {
IJavaValue value = expressionEvaluator.getValue(expr, Collections.<Effect>emptySet());
if (value.isNull()) {
//System.out.println(" Extending null");
return null;
}
IJavaType type = expr.getStaticType();
if (EclipseUtils.isObjectOrInterface(type))
return extendObject(expr, evaledExprs, typeConstraint, searchConstructors);
else if (searchOperators && EclipseUtils.isInt(type))
return extendNumber(expr);
else if (EclipseUtils.isArray(type))
return extendArray(expr);
else {
//System.out.println(" Cannot extend expression's type.");
return null;
}
}
示例2: getActualTypeForDowncast
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
/**
* Gets the lowest-possible legal type to which we might
* want to downcast the given expression.
* @param e The expression.
* @param isStatic Whether the receiver is static.
* @return The lowest legal type to which we might want to
* downcast the given expression.
* @throws DebugException
* @throws JavaModelException
*/
protected IJavaType getActualTypeForDowncast(Expression e, boolean isStatic) throws DebugException, JavaModelException {
IJavaValue receiverValue = expressionEvaluator.getValue(e, Collections.<Effect>emptySet());
IJavaType curType = !isStatic && receiverValue != null && !receiverValue.isNull() ? receiverValue.getJavaType() : e.getStaticType();
if (!(curType instanceof IJavaClassType)) // This can happen when something of static type Object is actually an array.
return null;
while (curType.getName().indexOf('$') != -1 && curType instanceof IJavaClassType) { // Avoid downcasting to anonymous types.
IType itype = project.findType(curType.getName(), (IProgressMonitor)null);
if (itype == null || !itype.isAnonymous())
break;
curType = ((IJavaClassType)curType).getSuperclass();
}
while (curType != null && !curType.equals(e.getStaticType()) && curType.getName().startsWith("sun."))
curType = ((IJavaClassType)curType).getSuperclass(); // As a heuristic optimization, avoid downcasting to private sun. types.
if (curType == null)
curType = e.getStaticType();
return curType;
}
示例3: getHashCode
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
protected int getHashCode(IJavaValue value) throws DebugException {
if (value == null || value.isNull())
return -37;
else if (value instanceof IJavaPrimitiveValue)
return ((IJavaPrimitiveValue)value).getIntValue() * 5 + 137; // We add a number to avoid clustering around 0.
else if (value instanceof IJavaArray) { // Heuristically only look at the array's length and its first ten elements.
IJavaArray array = (IJavaArray)value;
int length = array.getLength();
int hashCode = length * 5 + array.getSignature().hashCode() * 7;
for (int i = 0; i < 10 && i < length; i++)
hashCode = 31 * hashCode + getHashCode(array.getValue(i));
return hashCode;
} else if (value instanceof IJavaClassObject)
return ((IJavaClassObject)value).getInstanceType().getName().hashCode() * 11;
else if ("V".equals(value.getSignature()))
return -137;
else {
IJavaObject obj = (IJavaObject)value;
if ("Ljava/lang/String;".equals(obj.getSignature())) // Fast-path Strings
return obj.toString().hashCode();
return ((IJavaPrimitiveValue)obj.sendMessage("hashCode", "()I", new IJavaValue[] { }, thread, null)).getIntValue();
}
}
示例4: getValues
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private Object getValues(IJavaArray javaArray) {
try {
String compType = getComponentType(javaArray);
int dimensions = getDimensions(javaArray);
PrimitiveType primitive = PrimitiveType.match(compType);
IJavaValue[] values = javaArray.getValues();
Object array = null;
if(primitive != null) {
Class<?> type = primitive.getArrayClass(dimensions);
array = Array.newInstance(type, values.length);
}
else
array = Array.newInstance(Object.class, values.length);
if(getDimensions(javaArray) == 1) {
if(primitive == null) {
for(int j = 0; j < values.length; j++)
if(!values[j].isNull())
Array.set(array, j, values[j].getValueString());
}
else {
primitive.fillPrimitiveValues(array, values);
}
}
else {
for(int i = 0; i < values.length; i++) {
IJavaValue val = values[i];
if(!val.isNull())
Array.set(array, i, getValues((IJavaArray) val));
}
}
return array;
}
catch (DebugException e) {
e.printStackTrace();
getRuntimeModel().setTerminated();
return new Object[0];
}
}
示例5: addCalls
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private void addCalls(List<? extends Statement> stmts, List<Expression> calls) throws DebugException {
for (Statement stmt: stmts) {
if (stmt instanceof Expression) {
Expression e = (Expression)stmt;
IJavaValue value = expressionEvaluator.getValue(e, Collections.<Effect>emptySet());
if (value != null && (e instanceof MethodInvocation || e instanceof ClassInstanceCreation || e instanceof SuperMethodInvocation)
&& !(value instanceof IJavaPrimitiveValue || value.isNull() || (value instanceof IJavaObject && "Ljava/lang/String;".equals(value.getSignature()))))
calls.add((Expression)stmt);
} else if (stmt instanceof Block) {
addCalls(Arrays.asList(((Block)stmt).statements()), calls);
}
}
}
示例6: charArrOfValue
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private static char[] charArrOfValue(Value wrapper) throws DebugException {
IJavaValue value = wrapper.getValue();
if (value.isNull())
return null;
IJavaArray array = (IJavaArray)value;
char[] result = new char[array.getLength()];
IJavaValue[] arrayValues = array.getValues();
for (int i = 0; i < result.length; i++)
result[i] = charOfValue(arrayValues[i]);
return result;
}
示例7: byteArrOfValue
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private static byte[] byteArrOfValue(Value wrapper) throws DebugException {
IJavaValue value = wrapper.getValue();
if (value.isNull())
return null;
IJavaArray array = (IJavaArray)value;
byte[] result = new byte[array.getLength()];
IJavaValue[] arrayValues = array.getValues();
for (int i = 0; i < result.length; i++)
result[i] = byteOfValue(arrayValues[i]);
return result;
}
示例8: longArrOfValue
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private static long[] longArrOfValue(Value wrapper) throws DebugException {
IJavaValue value = wrapper.getValue();
if (value.isNull())
return null;
IJavaArray array = (IJavaArray)value;
long[] result = new long[array.getLength()];
IJavaValue[] arrayValues = array.getValues();
for (int i = 0; i < result.length; i++)
result[i] = longOfValue(arrayValues[i]);
return result;
}
示例9: intArrOfValue
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private static int[] intArrOfValue(Value wrapper) throws DebugException {
IJavaValue value = wrapper.getValue();
if (value.isNull())
return null;
IJavaArray array = (IJavaArray)value;
int[] result = new int[array.getLength()];
IJavaValue[] arrayValues = array.getValues();
for (int i = 0; i < result.length; i++)
result[i] = intOfValue(arrayValues[i]);
return result;
}
示例10: shortArrOfValue
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private static short[] shortArrOfValue(Value wrapper) throws DebugException {
IJavaValue value = wrapper.getValue();
if (value.isNull())
return null;
IJavaArray array = (IJavaArray)value;
short[] result = new short[array.getLength()];
IJavaValue[] arrayValues = array.getValues();
for (int i = 0; i < result.length; i++)
result[i] = shortOfValue(arrayValues[i]);
return result;
}
示例11: doubleArrOfValue
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private static double[] doubleArrOfValue(Value wrapper) throws DebugException {
IJavaValue value = wrapper.getValue();
if (value.isNull())
return null;
IJavaArray array = (IJavaArray)value;
double[] result = new double[array.getLength()];
IJavaValue[] arrayValues = array.getValues();
for (int i = 0; i < result.length; i++)
result[i] = doubleOfValue(arrayValues[i]);
return result;
}
示例12: floatArrOfValue
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private static float[] floatArrOfValue(Value wrapper) throws DebugException {
IJavaValue value = wrapper.getValue();
if (value.isNull())
return null;
IJavaArray array = (IJavaArray)value;
float[] result = new float[array.getLength()];
IJavaValue[] arrayValues = array.getValues();
for (int i = 0; i < result.length; i++)
result[i] = floatOfValue(arrayValues[i]);
return result;
}
示例13: booleanArrOfValue
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private static boolean[] booleanArrOfValue(Value wrapper) throws DebugException {
IJavaValue value = wrapper.getValue();
if (value.isNull())
return null;
IJavaArray array = (IJavaArray)value;
boolean[] result = new boolean[array.getLength()];
IJavaValue[] arrayValues = array.getValues();
for (int i = 0; i < result.length; i++)
result[i] = booleanOfValue(arrayValues[i]);
return result;
}
示例14: stringArrOfValue
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
private static String[] stringArrOfValue(Value wrapper) throws DebugException {
IJavaValue value = wrapper.getValue();
if (value.isNull())
return null;
IJavaArray array = (IJavaArray)value;
String[] result = new String[array.getLength()];
IJavaValue[] arrayValues = array.getValues();
for (int i = 0; i < result.length; i++)
result[i] = stringOfValue(arrayValues[i]);
return result;
}
示例15: computeArrayAccess
import org.eclipse.jdt.debug.core.IJavaValue; //导入方法依赖的package包/类
static IJavaValue computeArrayAccess(IJavaValue l, IJavaValue r) throws NumberFormatException, DebugException {
if (l.isNull())
return null;
int index = Integer.parseInt(r.getValueString());
if (index < 0)
return null;
IJavaArray array = (IJavaArray)l;
if (index >= array.getLength())
return null;
return array.getValue(index);
}