private static IncompatibleTypes getPriorityForAssumingCompatibleWithArray(Type rhsType) { if (rhsType.equals(Type.OBJECT)) { return ARRAY_AND_OBJECT; } String sig = rhsType.getSignature(); if ("Ljava/io/Serializable;".equals(sig) || "Ljava/lang/Cloneable;".equals(sig)) { return SEEMS_OK; } return ARRAY_AND_NON_ARRAY; }
private Type merge(Type prevType, Type newType) throws DataflowAnalysisException { if (prevType.equals(TopType.instance())) { if (DEBUG) { System.out.println("Got " + newType); } return newType; } else if (prevType.equals(newType)) { return prevType; } else { Type result = typeMerger.mergeTypes(prevType, newType); if (DEBUG) { System.out.println("Merged " + newType + ", got " + result); } return result; } }
static public @Nonnull IncompatibleTypes getPriorityForAssumingCompatible(Type expectedType, Type actualType, boolean pointerEquality) { if (expectedType.equals(actualType)) { return SEEMS_OK; if (!expectedType.equals(actualType)) { return INCOMPATIBLE_PRIMATIVE_ARRAYS; } else { return getPriorityForAssumingCompatibleWithArray(expectedType); if (expectedType.equals(actualType)) { return SEEMS_OK;
@Override public void initEntryFact(TypeFrame result) { super.initEntryFact(result); for (int i = 0; i < methodGen.getMaxLocals(); i++) { Type t = result.getValue(i); if (t.equals(Type.STRING)) { result.setValue(i, parameterStringTypeInstance); } } } }
if (operandType.equals(TopType.instance())) {
@Override protected void mergeValues(TypeFrame otherFrame, TypeFrame resultFrame, int slot) throws DataflowAnalysisException { Type type2 = resultFrame.getValue(slot); Type type1 = otherFrame.getValue(slot); Type value = typeMerger.mergeTypes(type2, type1); resultFrame.setValue(slot, value); // Result type is exact IFF types are identical and both are exact boolean typesAreIdentical = type1.equals(type2); boolean bothExact = resultFrame.isExact(slot) && otherFrame.isExact(slot); resultFrame.setExact(slot, typesAreIdentical && bothExact); }
private Method findSuperclassMethod(@DottedClassName String superclassName, Method subclassMethod) throws ClassNotFoundException { String methodName = subclassMethod.getName(); Type[] subArgs = null; JavaClass superClass = Repository.lookupClass(superclassName); Method[] methods = superClass.getMethods(); outer: for (Method m : methods) { if (m.getName().equals(methodName)) { if (subArgs == null) { subArgs = Type.getArgumentTypes(subclassMethod.getSignature()); } Type[] superArgs = Type.getArgumentTypes(m.getSignature()); if (subArgs.length == superArgs.length) { for (int j = 0; j < subArgs.length; j++) { if (!superArgs[j].equals(subArgs[j])) { continue outer; } } return m; } } } if (!"Object".equals(superclassName)) { @DottedClassName String superSuperClassName = superClass.getSuperclassName(); if (superSuperClassName.equals(superclassName)) { throw new ClassNotFoundException("superclass of " + superclassName + " is itself"); } return findSuperclassMethod(superSuperClassName, subclassMethod); } return null; }
if (operandType.equals(TopType.instance())) {
if (operandType.equals(TopType.instance())) {
if (operandType.equals(TopType.instance())) {
Type callReturnType = Type.getReturnType(callSeen.getMethodDescriptor().getSignature()); Type methodReturnType = Type.getReturnType(getMethodSig()); if(callReturnType.equals(methodReturnType) && callReturnType != Type.BOOLEAN && callReturnType != Type.VOID) { priority = HIGH_PRIORITY; } else {
/** @return true if both type objects refer to the same array type. */ @Override public boolean equals( final Object _type ) { if (_type instanceof ArrayType) { final ArrayType array = (ArrayType) _type; return (array.dimensions == dimensions) && array.basic_type.equals(basic_type); } return false; } }
private static IncompatibleTypes getPriorityForAssumingCompatibleWithArray(Type rhsType) { if (rhsType.equals(Type.OBJECT)) { return ARRAY_AND_OBJECT; } String sig = rhsType.getSignature(); if ("Ljava/io/Serializable;".equals(sig) || "Ljava/lang/Cloneable;".equals(sig)) { return SEEMS_OK; } return ARRAY_AND_NON_ARRAY; }
@Override public void initEntryFact(TypeFrame result) { super.initEntryFact(result); for (int i = 0; i < methodGen.getMaxLocals(); i++) { Type t = result.getValue(i); if (t.equals(Type.STRING)) { result.setValue(i, parameterStringTypeInstance); } } } }
@Override protected void mergeValues(TypeFrame otherFrame, TypeFrame resultFrame, int slot) throws DataflowAnalysisException { Type type2 = resultFrame.getValue(slot); Type type1 = otherFrame.getValue(slot); Type value = typeMerger.mergeTypes(type2, type1); resultFrame.setValue(slot, value); // Result type is exact IFF types are identical and both are exact boolean typesAreIdentical = type1.equals(type2); boolean bothExact = resultFrame.isExact(slot) && otherFrame.isExact(slot); resultFrame.setExact(slot, typesAreIdentical && bothExact); }