Java Code Examples for org.jf.dexlib2.iface.reference.TypeReference#getType()

The following examples show how to use org.jf.dexlib2.iface.reference.TypeReference#getType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuilderExceptionHandler.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
static BuilderExceptionHandler newExceptionHandler(@Nullable final TypeReference exceptionType,
                                            @Nonnull Label handler) {
    if (exceptionType == null) {
        return newExceptionHandler(handler);
    }
    return new BuilderExceptionHandler(handler) {
        @Nullable @Override public String getExceptionType() {
            return exceptionType.getType();
        }

        @Override public int getHandlerCodeAddress() {
            return handler.getCodeAddress();
        }

        @Nullable @Override public TypeReference getExceptionTypeReference() {
            return exceptionType;
        }
    };
}
 
Example 2
Source File: BuilderExceptionHandler.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
static BuilderExceptionHandler newExceptionHandler(@Nullable final TypeReference exceptionType,
                                            @Nonnull Label handler) {
    if (exceptionType == null) {
        return newExceptionHandler(handler);
    }
    return new BuilderExceptionHandler(handler) {
        @Nullable @Override public String getExceptionType() {
            return exceptionType.getType();
        }

        @Override public int getHandlerCodeAddress() {
            return handler.getCodeAddress();
        }

        @Nullable @Override public TypeReference getExceptionTypeReference() {
            return exceptionType;
        }
    };
}
 
Example 3
Source File: ConstClassInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
      if(!(instruction instanceof Instruction21c))
          throw new IllegalArgumentException("Expected Instruction21c but got: "+instruction.getClass());

      ReferenceInstruction constClass = (ReferenceInstruction) this.instruction;

      TypeReference tidi = (TypeReference)(constClass.getReference());
      String type = tidi.getType();
      if (type.startsWith("L") && type.endsWith(";"))
        type = type.replaceAll("^L", "").replaceAll(";$", "");

      int dest = ((OneRegisterInstruction) instruction).getRegisterA();
      Constant cst = ClassConstant.v(type);
      assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), cst);
      setUnit(assign);
      addTags(assign);
      body.add(assign);

if (IDalvikTyper.ENABLE_DVKTYPER) {
	Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
        int op = (int)instruction.getOpcode().value;
        //DalvikTyper.v().captureAssign((JAssignStmt)assign, op); //TODO: classtype could be null!
        DalvikTyper.v().setType(assign.getLeftOpBox(), cst.getType(), false);
      }
  }
 
Example 4
Source File: BuilderExceptionHandler.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
static BuilderExceptionHandler newExceptionHandler(@Nullable final TypeReference exceptionType,
                                            @Nonnull Label handler) {
    if (exceptionType == null) {
        return newExceptionHandler(handler);
    }
    return new BuilderExceptionHandler(handler) {
        @Nullable @Override public String getExceptionType() {
            return exceptionType.getType();
        }

        @Override public int getHandlerCodeAddress() {
            return handler.getCodeAddress();
        }

        @Nullable @Override public TypeReference getExceptionTypeReference() {
            return exceptionType;
        }
    };
}
 
Example 5
Source File: BuilderExceptionHandler.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
static BuilderExceptionHandler newExceptionHandler(@Nullable final TypeReference exceptionType,
                                            @Nonnull Label handler) {
    if (exceptionType == null) {
        return newExceptionHandler(handler);
    }
    return new BuilderExceptionHandler(handler) {
        @Nullable @Override public String getExceptionType() {
            return exceptionType.getType();
        }

        @Override public int getHandlerCodeAddress() {
            return handler.getCodeAddress();
        }

        @Nullable @Override public TypeReference getExceptionTypeReference() {
            return exceptionType;
        }
    };
}
 
Example 6
Source File: ImmutableTypeReference.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static ImmutableTypeReference of(@Nonnull TypeReference typeReference) {
    if (typeReference instanceof ImmutableTypeReference) {
        return (ImmutableTypeReference)typeReference;
    }
    return new ImmutableTypeReference(typeReference.getType());
}
 
Example 7
Source File: ImmutableTypeReference.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static ImmutableTypeReference of(@Nonnull TypeReference typeReference) {
    if (typeReference instanceof ImmutableTypeReference) {
        return (ImmutableTypeReference)typeReference;
    }
    return new ImmutableTypeReference(typeReference.getType());
}
 
Example 8
Source File: ImmutableTypeReference.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static ImmutableTypeReference of(@Nonnull TypeReference typeReference) {
    if (typeReference instanceof ImmutableTypeReference) {
        return (ImmutableTypeReference)typeReference;
    }
    return new ImmutableTypeReference(typeReference.getType());
}
 
Example 9
Source File: ImmutableTypeReference.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static ImmutableTypeReference of(@Nonnull TypeReference typeReference) {
    if (typeReference instanceof ImmutableTypeReference) {
        return (ImmutableTypeReference)typeReference;
    }
    return new ImmutableTypeReference(typeReference.getType());
}
 
Example 10
Source File: DexType.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
public DexType(TypeReference type) {
    if (type == null)
        throw new RuntimeException("error: type ref is null!");
    this.type = type;
    this.name = type.getType();
}
 
Example 11
Source File: DexType.java    From JAADAS with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Return if the given TypeIdItem is wide (i.e. occupies 2 registers).
 *
 * @param typeReference.getType() the TypeIdItem to analyze
 * @return if type is wide
 */
public static boolean isWide(TypeReference typeReference) {
    String t = typeReference.getType();
    return isWide(t);
}