Package soot

Examples of soot.Type


        RefType object = Scene.v().getSootClass(Object.class.getName())
                .getType();
        ArrayType objectArray = ArrayType.v(object, 1);
        RefType string = Scene.v().getSootClass(String.class.getName())
                .getType();
        Type booleanT = BooleanType.v();
        RefType classClass = Scene.v().getSootClass(Class.class.getName())
                .getType();
        RefType mapClass = Scene.v()
                .getSootClass(java.util.Map.class.getName()).getType();
View Full Code Here


     * @return the corresponding {@link SootMethod}
     */
    public SootMethod getSootMethod(SootClass containingClass, Method method1) {
        List<Type> argumentTypes = new LinkedList<Type>();
        for (Class<?> cl : method1.getParameterTypes()) {
            Type sootType = getSootType(cl);
            argumentTypes.add(sootType);
        }
        return containingClass.getMethod(method1.getName(), argumentTypes);
    }
View Full Code Here

     * @param cl
     *            as the class to to be found as #Type
     * @return the #Type corresponding to the given #Class
     */
    public Type getSootType(Class<?> cl) {
        Type sootType;
        if (cl.isArray()) {
            String sig = cl.getName();
            int depth = 0;
            for (char c : sig.toCharArray()) {
                if (c == '[') {
                    depth++;
                } else {
                    break;
                }
            }
            sig = sig.substring(depth);
            char type = sig.charAt(0);
            Type baseType;
            if (type == 'L') {
                baseType = Scene.v()
                        .getSootClass(sig.substring(1).replace(";", ""))
                        .getType();
            } else if (type == 'Z') {
View Full Code Here

                RefType refType = (RefType) t;
                usesSession = isSession(refType);
            } else if (t instanceof ArrayType) {
                // check if the array is a Session[]
                ArrayType arrayType = (ArrayType) t;
                Type type = arrayType.getElementType();
                if (type instanceof RefType) {
                    usesSession = isSession((RefType) type);
                }
            }
        }
View Full Code Here

     *         {@link java.lang.StringBuffer}, {@link java.lang.StringBuilder},
     *         or array (of any dimension) of {@link java.lang.String};
     *         <code>false</code> otherwise;
     */
    public static boolean hasValidType(ValueBox box) {
        Type t = box.getValue().getType();
        if (t instanceof RefType) {
            if (((RefType) t).getSootClass().getName().equals("java.lang.String")) {
                return true;
            }
            if (((RefType) t).getSootClass().getName().equals("java.lang.StringBuffer")) {
                return true;
            }
            if (((RefType) t).getSootClass().getName().equals("java.lang.StringBuilder")) {
                return true;
            }
        }
        if (t instanceof ArrayType) {
            Type bt = ((ArrayType) t).baseType;
            if (bt instanceof RefType && ((RefType) bt).getSootClass().getName().equals("java.lang.String")) {
                return true;
            }
        }
        return false;
View Full Code Here

    private Variable handleArrayNew(Type type) {
        if (getType(type) == VariableType.NONE// arrays of uninteresting types may be ignored
            return getNothing();
       
        // dig out the element type
        Type elementType = type;
        while (elementType instanceof ArrayType) {
            elementType = ((ArrayType)elementType).getElementType();
        }
       
        Variable var = makeVariable(VariableType.ARRAY);
View Full Code Here

   * if the subclass implements {@link ToXMLable}, an assignment is added from
   * a call to <code>toXML</code> on the value to the new variable.
   * Returns null is the input type is <code>NullType</code>.
   */
  public Variable getVariableFromArrayExp(ValueBox b) {
    Type t = b.getValue().getType();
    while (t instanceof ArrayType)
      t = ((ArrayType) t).getElementType();
    return getVarFromObjectExpByType(b, t);
  }
View Full Code Here

    if (!TranslatorContext.isStringType(b))
      throw new XMLValidationException("String expression expected " + b, origin);
    return sa.getAutomaton(b);
  }
  public Automaton getAutomatonFromObjectExp(ValueBox b) { // TODO: cache results of getAutomatonFromObjectExp?
    Type t = b.getValue().getType();
    if (t instanceof NullType)
      return Automaton.makeString("null");
    while (t instanceof ArrayType)
      t = ((ArrayType) t).getElementType();
    if (t instanceof RefType) {
      if (t.equals(RefType.v("java.lang.String")) || t.equals(RefType.v("java.lang.Object"))) { // for (arrays of) String, ask the string analyzer
        return sa.getAutomaton(b);
      } else { // for other reference types, take the union of the type automata for the possible types
        List<Automaton> auts = new ArrayList<Automaton>();
        for (SootClass sc : context.getSubclassesOfIncluding((RefType)t))
          if (!context.implementsToXMLable(sc))
View Full Code Here

                    queue.addAll(handleInvocation(stateMachine, method, st));
                } else if (st instanceof AssignStmt) {
                    // will not alter control flow, but an unanalyzable rhs
                    // might pop up
                    Value right = ((AssignStmt) st).getRightOp();
                    Type rightType = right.getType();
                    if (resolver.isInterestingType(rightType)
                            && !resolver.isAbstractPersistable(rightType)
                            && canBeAnything(right, rightType,
                                    method.getActiveBody(), st)) {
                        // The rhs can be anything, if it is interesting - we
View Full Code Here

        final SootClass xml = resolver.getSootClass(XML.class);
        for (State state : allStates) {
            if (state instanceof WebMethodState
                    || state instanceof HandlerState) {
                final SootMethod method = state.getMethod();
                final Type returnType = method.getReturnType();
                // TODO explicitly checking for the XML type. XML content
                // should be checked too perhaps?
                if (returnType instanceof RefType
                        && resolver.is(((RefType) returnType).getSootClass(),
                                xml))
View Full Code Here

TOP

Related Classes of soot.Type

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.