@Override public void visitPropertyRead(AstPropertyRead inst) { result = new DeclaredTypeOperator(new ConeType(cha.getRootClass())); }
} else if (type.isArrayClass() || other.type.isArrayClass()) { return new ConeType(type.getClassHierarchy().getRootClass()); } else { return new ConeType(type.getClassHierarchy().getLeastCommonSuperclass(this.type, other.type)); if (type.equals(other.getType())) { TypeReference T = other.getType().getReference(); if (type.isArrayClass() || T.isArrayType()) { return new ConeType(type.getClassHierarchy().getRootClass()); if (type.getClassHierarchy().isSubclassOf(typeKlass, other.getType())) { return other; } else if (other.isInterface()) { if (type.getClassHierarchy().implementsInterface(typeKlass, other.getType())) { return other; return other.meet(new ConeType(this.getType())); } else { Assertions.UNREACHABLE("Unexpected type: " + rhs.getClass());
elementType = ((PointType) arrayType).getType().getReference().getArrayElementType(); } else if (arrayType instanceof ConeType) { elementType = ((ConeType) arrayType).getType().getReference().getArrayElementType(); } else { Assertions.UNREACHABLE("Unexpected type " + arrayType.getClass()); tType = ((PointType) lhs.getType()).getType().getReference(); } else if (lhs.getType() instanceof ConeType) { tType = ((ConeType) lhs.getType()).getType().getReference(); } else { Assertions.UNREACHABLE("Unexpected type " + lhs.getType().getClass()); IClass klass = cha.lookupClass(elementType); assert klass != null; lhs.setType(new ConeType(klass)); return CHANGED; IClass klass = cha.lookupClass(elementType); if (klass != null) { lhs.setType(new ConeType(klass)); } else { lhs.setType(TypeAbstraction.TOP);
public boolean isInterface() { return getType().isInterface(); }
System.err.println(("Cone clause for " + T)); if (((ConeType) T).isInterface()) { Set<IClass> implementors = T.getType().getClassHierarchy().getImplementors(ref); if (DEBUG) {
@Test public void test4() { MethodReference method = scope.findMethod(AnalysisScope.APPLICATION, "LtypeInference/TI", Atom.findOrCreateUnicodeAtom("useCast"), new ImmutableByteArray(UTF8Convert.toUTF8("(Ljava/lang/Object;)V"))); Assert.assertNotNull("method not found", method); IMethod imethod = cha.resolveMethod(method); Assert.assertNotNull("imethod not found", imethod); IR ir = cache.getIRFactory().makeIR(imethod, Everywhere.EVERYWHERE, options.getSSAOptions()); System.out.println(ir); TypeInference ti = TypeInference.make(ir, false); TypeAbstraction type = ti.getType(4); Assert.assertNotNull("null type abstraction", type); Assert.assertTrue("inferred wrong type " + type, type instanceof ConeType && ((ConeType)type).getTypeReference().getName().toString().equals("Ljava/lang/String")); }
elementType = ((PointType) arrayType).getType().getReference().getArrayElementType(); } else if (arrayType instanceof ConeType) { elementType = ((ConeType) arrayType).getType().getReference().getArrayElementType(); } else { Assertions.UNREACHABLE("Unexpected type " + arrayType.getClass()); tType = ((PointType) lhs.getType()).getType().getReference(); } else if (lhs.getType() instanceof ConeType) { tType = ((ConeType) lhs.getType()).getType().getReference(); } else { Assertions.UNREACHABLE("Unexpected type " + lhs.getType().getClass()); IClass klass = cha.lookupClass(elementType); assert klass != null; lhs.setType(new ConeType(klass)); return CHANGED; IClass klass = cha.lookupClass(elementType); if (klass != null) { lhs.setType(new ConeType(klass)); } else { lhs.setType(TypeAbstraction.TOP);
public boolean isInterface() { return getType().isInterface(); }
System.err.println(("Cone clause for " + T)); if (((ConeType) T).isInterface()) { Set<IClass> implementors = T.getType().getClassHierarchy().getImplementors(ref); if (DEBUG) {
@Override public void visitEachElementGet(EachElementGetInstruction inst) { result = new DeclaredTypeOperator(new ConeType(cha.getRootClass())); }
} else if (type.isArrayClass() || other.type.isArrayClass()) { return new ConeType(type.getClassHierarchy().getRootClass()); } else { return new ConeType(type.getClassHierarchy().getLeastCommonSuperclass(this.type, other.type)); if (type.equals(other.getType())) { TypeReference T = other.getType().getReference(); if (type.isArrayClass() || T.isArrayType()) { return new ConeType(type.getClassHierarchy().getRootClass()); if (type.getClassHierarchy().isSubclassOf(typeKlass, other.getType())) { return other; } else if (other.isInterface()) { if (type.getClassHierarchy().implementsInterface(typeKlass, other.getType())) { return other; return other.meet(new ConeType(this.getType())); } else { Assertions.UNREACHABLE("Unexpected type: " + rhs.getClass());
public boolean isArrayType() { return getType().isArrayClass(); }
@Override public void visitAstGlobalRead(AstGlobalRead instruction) { result = new DeclaredTypeOperator(new ConeType(cha.getRootClass())); }
public boolean isArrayType() { return getType().isArrayClass(); }
@Override public void visitAstLexicalRead(AstLexicalRead inst) { result = new DeclaredTypeOperator(new ConeType(cha.getRootClass())); }
/** * @return an Iterator of IClass that implement this interface */ public Iterator<IClass> iterateImplementors() { return type.getClassHierarchy().getImplementors(getType().getReference()).iterator(); }
@Override public void visitAstLexicalRead(AstLexicalRead inst) { result = new DeclaredTypeOperator(new ConeType(cha.getRootClass())); }
/** * @return an Iterator of IClass that implement this interface */ public Iterator<IClass> iterateImplementors() { return type.getClassHierarchy().getImplementors(getType().getReference()).iterator(); }
@Override public void visitAstGlobalRead(AstGlobalRead instruction) { result = new DeclaredTypeOperator(new ConeType(cha.getRootClass())); }
@Override public void visitPropertyRead(AstPropertyRead inst) { result = new DeclaredTypeOperator(new ConeType(cha.getRootClass())); }