/** * Checks if all parameters and return value of a method have primitive types. * * @param mtd Method. * @return boolean True if all parameters and return value are of primitive type, otherwise false. */ private static boolean isAllPrimitiveTypes(IMethod mtd) { if (!mtd.getReturnType().isPrimitiveType()) return false; for (int i = (mtd.isStatic() ? 0 : 1); i < mtd.getNumberOfParameters(); i++) { if (!mtd.getParameterType(i).isPrimitiveType()) return false; } return true; }
if (!mtd.getReturnType().isPrimitiveType()) { if (analysisDriver == null) { analysisDriver = getAnalysisDriver(mtd, options, cache, cha);
if (method.getReturnType().isPrimitiveType()) { LOG(DEBUG, "DEBUG", "Skipping method with primitive return type: " + method.getSignature()); return NullnessHint.UNKNOWN;
/** * Does 'this' refer to a reference type */ public final boolean isReferenceType() { return !isPrimitiveType(); }
/** * @return true iff this represents an array access of a primitive type element */ public boolean typeIsPrimitive() { return elementType.isPrimitiveType(); }
/** * Does 'this' refer to a class? */ public final boolean isClassType() { return !isArrayType() && !isPrimitiveType(); }
/** * Does this class represent an array of primitives? */ public boolean isOfPrimitives() { return this.type.getInnermostElementType().isPrimitiveType(); }
/** * Does 'this' refer to a class? */ public final boolean isClassType() { return !isArrayType() && !isPrimitiveType(); }
@Override public void visitGet(SSAGetInstruction instruction) { FieldReference field = instruction.getDeclaredField(); if (!field.getFieldType().isPrimitiveType()) { bingo = true; } }
@Override public void visitPut(SSAPutInstruction instruction) { FieldReference field = instruction.getDeclaredField(); if (!field.getFieldType().isPrimitiveType()) { bingo = true; } }
@Override public void visitArrayLoad(IArrayLoadInstruction instruction) { if (!includePrimOps) { TypeReference tr = ShrikeUtil.makeTypeReference(loader, instruction.getType()); // ISSUE is this the right check? if (tr.isPrimitiveType()) { return; } } arrayReads.add(new MemoryAccess(instructionIndex, node)); }
private static boolean dispatchIndex(CallSiteReference ref, int i) { if (ref.isStatic()) { return ! ref.getDeclaredTarget().getParameterType(i).isPrimitiveType(); } else { return i==0 || ! ref.getDeclaredTarget().getParameterType(i-1).isPrimitiveType(); } }
private int makeArgument(TypeReference tr) { if (tr.isPrimitiveType()) return addLocal(); else { SSANewInstruction n = processAllocation(tr, nextLocal++, false); return (n == null) ? -1 : n.getDef(); } }
/** * @return the IClass that represents the innermost array element type, or null if the element type is a primitive */ public IClass getInnermostElementClass() { TypeReference elementType = getReference().getInnermostElementType(); if (elementType.isPrimitiveType()) { return null; } return loader.lookupClass(elementType.getName()); }
/** * for an array class, get the innermost type, or null if it's primitive */ private IClass getInnermostTypeOfArrayClass(IClass klass) { TypeReference result = klass.getReference(); while (result.isArrayType()) { result = result.getArrayElementType(); } return result.isPrimitiveType() ? null : lookupClass(result); }
public static TypeReference findOrCreateReferenceTo(TypeReference t) { if (t == null) { throw new IllegalArgumentException("t is null"); } TypeName name = t.getName(); if (t.isPrimitiveType()) { return findOrCreate(ClassLoaderReference.Primordial, name.getReferenceTypeForElementType()); } else { return findOrCreate(t.getClassLoader(), name.getReferenceTypeForElementType()); } }
public static TypeReference findOrCreateArrayOf(TypeReference t) { if (t == null) { throw new IllegalArgumentException("t is null"); } TypeName name = t.getName(); if (t.isPrimitiveType()) { return findOrCreate(ClassLoaderReference.Primordial, name.getArrayTypeForElementType()); } else { return findOrCreate(t.getClassLoader(), name.getArrayTypeForElementType()); } }
public static TypeReference findOrCreatePointerTo(TypeReference t) { if (t == null) { throw new IllegalArgumentException("t is null"); } TypeName name = t.getName(); if (t.isPrimitiveType()) { return findOrCreate(ClassLoaderReference.Primordial, name.getPointerTypeForElementType()); } else { return findOrCreate(t.getClassLoader(), name.getPointerTypeForElementType()); } }
/** * @see com.ibm.wala.shrikeBT.IInstruction.Visitor#visitReturn(ReturnInstruction) */ @Override public void visitReturn(com.ibm.wala.shrikeBT.ReturnInstruction instruction) { if (instruction.getPoppedCount() == 1) { int result = workingState.pop(); TypeReference t = ShrikeUtil.makeTypeReference(loader, instruction.getType()); emitInstruction(insts.ReturnInstruction(getCurrentInstructionIndex(), result, t.isPrimitiveType())); } else { emitInstruction(insts.ReturnInstruction(getCurrentInstructionIndex())); } }
@Override public SSAInstruction[] getStatements() { if (getReturnType().equals(TypeReference.Void)) { return NO_STATEMENTS; } else { int nullValue = getNumberOfParameters() + 1; SSAInstruction[] result = new SSAInstruction[1]; SSAInstructionFactory insts = l.instructionFactory(); result[0] = insts.ReturnInstruction(0, nullValue, getReturnType().isPrimitiveType()); return result; } }