当前位置: 首页>>代码示例>>Java>>正文


Java ReferenceType.METHOD属性代码示例

本文整理汇总了Java中org.jf.dexlib2.ReferenceType.METHOD属性的典型用法代码示例。如果您正苦于以下问题:Java ReferenceType.METHOD属性的具体用法?Java ReferenceType.METHOD怎么用?Java ReferenceType.METHOD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.jf.dexlib2.ReferenceType的用法示例。


在下文中一共展示了ReferenceType.METHOD属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeReference

public static void writeReference(IndentingWriter writer, int referenceType,
                                  Reference reference) throws IOException {
    switch (referenceType) {
        case ReferenceType.STRING:
            writeStringReference(writer, ((StringReference)reference).getString());
            return;
        case ReferenceType.TYPE:
            writer.write(((TypeReference)reference).getType());
            return;
        case ReferenceType.METHOD:
            ReferenceUtil.writeMethodDescriptor(writer, (MethodReference) reference);
            return;
        case ReferenceType.FIELD:
            ReferenceUtil.writeFieldDescriptor(writer, (FieldReference)reference);
            return;
        default:
            throw new IllegalStateException("Unknown reference type");
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:19,代码来源:ReferenceFormatter.java

示例2: writeReference

public static void writeReference(IndentingWriter writer, int referenceType,
                                  Reference reference) throws IOException {
    switch (referenceType) {
        case ReferenceType.STRING:
            writeStringReference(writer, ((StringReference)reference).getString());
            return;
        case ReferenceType.TYPE:
            writer.write(((TypeReference)reference).getType());
            return;
        case ReferenceType.METHOD:
            ReferenceUtil.writeMethodDescriptor(writer, (MethodReference)reference);
            return;
        case ReferenceType.FIELD:
            ReferenceUtil.writeFieldDescriptor(writer, (FieldReference)reference);
            return;
        default:
            throw new IllegalStateException("Unknown reference type");
    }
}
 
开发者ID:Miracle963,项目名称:zjdroid,代码行数:19,代码来源:ReferenceFormatter.java

示例3: getReferenceIndex

private int getReferenceIndex(int referenceType, Reference reference) {
    switch (referenceType) {
        case ReferenceType.FIELD:
            return fieldSection.getItemIndex((FieldRefKey) reference);
        case ReferenceType.METHOD:
            return methodSection.getItemIndex((MethodRefKey) reference);
        case ReferenceType.STRING:
            return stringSection.getItemIndex((StringRef) reference);
        case ReferenceType.TYPE:
            return typeSection.getItemIndex((TypeRef) reference);
        case ReferenceType.METHOD_PROTO:
            return protoSection.getItemIndex((ProtoRefKey) reference);
        default:
            throw new ExceptionWithContext("Unknown reference type: %d",  referenceType);
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:16,代码来源:InstructionWriter.java

示例4: makeReference

public static Reference makeReference( DexBackedDexFile dexFile, int referenceType, int referenceIndex) {
    switch (referenceType) {
        case ReferenceType.STRING:
            return new DexBackedStringReference(dexFile, referenceIndex);
        case ReferenceType.TYPE:
            return new DexBackedTypeReference(dexFile, referenceIndex);
        case ReferenceType.METHOD:
            return new DexBackedMethodReference(dexFile, referenceIndex);
        case ReferenceType.FIELD:
            return new DexBackedFieldReference(dexFile, referenceIndex);
        case ReferenceType.METHOD_PROTO:
            return new DexBackedMethodProtoReference(dexFile, referenceIndex);
        default:
            throw new ExceptionWithContext("Invalid reference type: %d", referenceType);
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:16,代码来源:DexBackedReference.java

示例5: getReference

@Override
@Nonnull
public Reference getReference() {
    switch (getReferenceType()) {
        case ReferenceType.TYPE:
            return RewriterUtils.rewriteTypeReference(rewriters.getTypeRewriter(),
                    (TypeReference) instruction.getReference());
        case ReferenceType.FIELD:
            return rewriters.getFieldReferenceRewriter().rewrite((FieldReference) instruction.getReference());
        case ReferenceType.METHOD:
            return rewriters.getMethodReferenceRewriter().rewrite((MethodReference) instruction.getReference());
        case ReferenceType.STRING:
            return instruction.getReference();
        default:
            throw new IllegalArgumentException();
    }
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:17,代码来源:InstructionRewriter.java

示例6: analyze

private void analyze(@Nonnull DexBackedMethodImplementation implementation) {
    cyclomaticComplexity = calculateComplexity(implementation);
    registerCount = implementation.getRegisterCount();
    tryCatchCount = implementation.getTryBlocks().size();
    debugItemCount = Utils.makeCollection(implementation.getDebugItems()).size();

    for (Instruction instruction : implementation.getInstructions()) {
        instructionCount++;
        Opcode op = instruction.getOpcode();
        opCounts.adjustOrPutValue(op, 1, 1);

        if (instruction instanceof ReferenceInstruction) {
            ReferenceInstruction refInstr = (ReferenceInstruction) instruction;
            switch (op.referenceType) {
                case ReferenceType.METHOD:
                    MethodReference methodRef = (MethodReference) refInstr.getReference();
                    if (fullMethodSignatures) {
                        apiCounts.adjustOrPutValue(methodRef, 1, 1);
                    } else {
                        ShortMethodReference shortMethodRef = new ShortMethodReference(methodRef);
                        apiCounts.adjustOrPutValue(shortMethodRef, 1, 1);
                    }
                    break;
                case ReferenceType.FIELD:
                    FieldReference fieldRef = (FieldReference) refInstr.getReference();
                    fieldReferenceCounts.adjustOrPutValue(fieldRef, 1, 1);
                    break;
                case ReferenceType.STRING:
                    StringReference stringRef = (StringReference) refInstr.getReference();
                    stringReferenceCounts.adjustOrPutValue(stringRef, 1, 1);
                    break;
            }
        }
    }
}
 
开发者ID:CalebFenton,项目名称:apkfile,代码行数:35,代码来源:DexMethod.java

示例7: of

@Nonnull
public static ImmutableReference of(int referenceType, Reference reference) {
    switch (referenceType) {
        case ReferenceType.STRING:
            return ImmutableStringReference.of((StringReference)reference);
        case ReferenceType.TYPE:
            return ImmutableTypeReference.of((TypeReference)reference);
        case ReferenceType.FIELD:
            return ImmutableFieldReference.of((FieldReference)reference);
        case ReferenceType.METHOD:
            return ImmutableMethodReference.of((MethodReference)reference);
    }
    throw new ExceptionWithContext("Invalid reference type: %d", referenceType);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:14,代码来源:ImmutableReferenceFactory.java

示例8: getReferenceIndex

private int getReferenceIndex(ReferenceInstruction referenceInstruction) {
    switch (referenceInstruction.getOpcode().referenceType) {
        case ReferenceType.FIELD:
            return fieldSection.getItemIndex((FieldRefKey)referenceInstruction.getReference());
        case ReferenceType.METHOD:
            return methodSection.getItemIndex((MethodRefKey)referenceInstruction.getReference());
        case ReferenceType.STRING:
            return stringSection.getItemIndex((StringRef)referenceInstruction.getReference());
        case ReferenceType.TYPE:
            return typeSection.getItemIndex((TypeRef)referenceInstruction.getReference());
        default:
            throw new ExceptionWithContext("Unknown reference type: %d",
                    referenceInstruction.getOpcode().referenceType);
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:15,代码来源:InstructionWriter.java

示例9: getReference

@Override @Nonnull public Reference getReference() {
    switch (getReferenceType()) {
        case ReferenceType.TYPE:
            return RewriterUtils.rewriteTypeReference(rewriters.getTypeRewriter(),
                    (TypeReference)instruction.getReference());
        case ReferenceType.FIELD:
            return rewriters.getFieldReferenceRewriter().rewrite((FieldReference)instruction.getReference());
        case ReferenceType.METHOD:
            return rewriters.getMethodReferenceRewriter().rewrite((MethodReference)instruction.getReference());
        case ReferenceType.STRING:
            return instruction.getReference();
        default:
            throw new IllegalArgumentException();
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:15,代码来源:InstructionRewriter.java

示例10: makeReference

public static Reference makeReference(@Nonnull DexBackedDexFile dexFile, int referenceType, int referenceIndex) {
    switch (referenceType) {
        case ReferenceType.STRING:
            return new DexBackedStringReference(dexFile, referenceIndex);
        case ReferenceType.TYPE:
            return new DexBackedTypeReference(dexFile, referenceIndex);
        case ReferenceType.METHOD:
            return new DexBackedMethodReference(dexFile, referenceIndex);
        case ReferenceType.FIELD:
            return new DexBackedFieldReference(dexFile, referenceIndex);
        default:
            throw new ExceptionWithContext("Invalid reference type: %d", referenceType);
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:14,代码来源:DexBackedReference.java

示例11: checkReference

public static <T extends Reference> T checkReference(int referenceType, T reference) {
    switch (referenceType) {
        case ReferenceType.STRING:
            if (!(reference instanceof StringReference)) {
                throw new IllegalArgumentException("Invalid reference type, expecting a string reference");
            }
            break;
        case ReferenceType.TYPE:
            if (!(reference instanceof TypeReference)) {
                throw new IllegalArgumentException("Invalid reference type, expecting a type reference");
            }
            break;
        case ReferenceType.FIELD:
            if (!(reference instanceof FieldReference)) {
                throw new IllegalArgumentException("Invalid reference type, expecting a field reference");
            }
            break;
        case ReferenceType.METHOD:
            if (!(reference instanceof MethodReference)) {
                throw new IllegalArgumentException("Invalid reference type, expecting a method reference");
            }
            break;
        default:
            throw new IllegalArgumentException(String.format("Not a valid reference type: %d", referenceType));
    }
    return reference;
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:Preconditions.java

示例12: of

public static ImmutableReference of(int referenceType, Reference reference) {
    switch (referenceType) {
        case ReferenceType.STRING:
            return ImmutableStringReference.of((StringReference)reference);
        case ReferenceType.TYPE:
            return ImmutableTypeReference.of((TypeReference)reference);
        case ReferenceType.FIELD:
            return ImmutableFieldReference.of((FieldReference)reference);
        case ReferenceType.METHOD:
            return ImmutableMethodReference.of((MethodReference)reference);
        case ReferenceType.METHOD_PROTO:
            return ImmutableMethodProtoReference.of((MethodProtoReference)reference);
    }
    throw new ExceptionWithContext("Invalid reference type: %d", referenceType);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:15,代码来源:ImmutableReferenceFactory.java

示例13: getReference

@Override  public Reference getReference() {
    switch (getReferenceType()) {
        case ReferenceType.TYPE:
            return RewriterUtils.rewriteTypeReference(rewriters.getTypeRewriter(),
                    (TypeReference)instruction.getReference());
        case ReferenceType.FIELD:
            return rewriters.getFieldReferenceRewriter().rewrite((FieldReference)instruction.getReference());
        case ReferenceType.METHOD:
            return rewriters.getMethodReferenceRewriter().rewrite((MethodReference)instruction.getReference());
        case ReferenceType.STRING:
            return instruction.getReference();
        default:
            throw new IllegalArgumentException();
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:15,代码来源:InstructionRewriter.java

示例14: writeTo

public boolean writeTo(IndentingWriter writer) throws IOException {
    writer.write("# ");
    switch (accessedMember.accessedMemberType) {
        case SyntheticAccessorResolver.METHOD:
            writer.write("invokes: ");
            break;
        case SyntheticAccessorResolver.GETTER:
            writer.write("getter for: ");
            break;
        case SyntheticAccessorResolver.SETTER:
            writer.write("setter for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_INCREMENT:
            writer.write("++operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_INCREMENT:
            writer.write("operator++ for: ");
            break;
        case SyntheticAccessorResolver.PREFIX_DECREMENT:
            writer.write("--operator for: ");
            break;
        case SyntheticAccessorResolver.POSTFIX_DECREMENT:
            writer.write("operator-- for: ");
            break;
        case SyntheticAccessorResolver.ADD_ASSIGNMENT:
            writer.write("+= operator for: ");
            break;
        case SyntheticAccessorResolver.SUB_ASSIGNMENT:
            writer.write("-= operator for: ");
            break;
        case SyntheticAccessorResolver.MUL_ASSIGNMENT:
            writer.write("*= operator for: ");
            break;
        case SyntheticAccessorResolver.DIV_ASSIGNMENT:
            writer.write("/= operator for: ");
            break;
        case SyntheticAccessorResolver.REM_ASSIGNMENT:
            writer.write("%= operator for: ");
            break;
        case SyntheticAccessorResolver.AND_ASSIGNMENT:
            writer.write("&= operator for: ");
            break;
        case SyntheticAccessorResolver.OR_ASSIGNMENT:
            writer.write("|= operator for: ");
            break;
        case SyntheticAccessorResolver.XOR_ASSIGNMENT:
            writer.write("^= operator for: ");
            break;
        case SyntheticAccessorResolver.SHL_ASSIGNMENT:
            writer.write("<<= operator for: ");
            break;
        case SyntheticAccessorResolver.SHR_ASSIGNMENT:
            writer.write(">>= operator for: ");
            break;
        case SyntheticAccessorResolver.USHR_ASSIGNMENT:
            writer.write(">>>= operator for: ");
            break;
        default:
            throw new ExceptionWithContext("Unknown access type: %d", accessedMember.accessedMemberType);
    }

    int referenceType;
    if (accessedMember.accessedMemberType == SyntheticAccessorResolver.METHOD) {
        referenceType = ReferenceType.METHOD;
    } else {
        referenceType = ReferenceType.FIELD;
    }
    ReferenceFormatter.writeReference(writer, referenceType, accessedMember.accessedMember);
    return true;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:70,代码来源:SyntheticAccessCommentMethodItem.java

示例15: internCode

private void internCode(@Nonnull Method method) {
    // this also handles parameter names, which aren't directly tied to the MethodImplementation, even though the debug items are
    boolean hasInstruction = false;

    MethodImplementation methodImpl = method.getImplementation();
    if (methodImpl != null) {
        for (Instruction instruction: methodImpl.getInstructions()) {
            hasInstruction = true;
            if (instruction instanceof ReferenceInstruction) {
                Reference reference = ((ReferenceInstruction)instruction).getReference();
                switch (instruction.getOpcode().referenceType) {
                    case ReferenceType.STRING:
                        stringPool.intern((StringReference)reference);
                        break;
                    case ReferenceType.TYPE:
                        typePool.intern((TypeReference)reference);
                        break;
                    case ReferenceType.FIELD:
                        fieldPool.intern((FieldReference) reference);
                        break;
                    case ReferenceType.METHOD:
                        methodPool.intern((MethodReference)reference);
                        break;
                    default:
                        throw new ExceptionWithContext("Unrecognized reference type: %d",
                                instruction.getOpcode().referenceType);
                }
            }
        }

        List<? extends TryBlock> tryBlocks = methodImpl.getTryBlocks();
        if (!hasInstruction && tryBlocks.size() > 0) {
            throw new ExceptionWithContext("Method %s has no instructions, but has try blocks.",
                    ReferenceUtil.getMethodDescriptor(method));
        }

        for (TryBlock<? extends ExceptionHandler> tryBlock: methodImpl.getTryBlocks()) {
            for (ExceptionHandler handler: tryBlock.getExceptionHandlers()) {
                typePool.internNullable(handler.getExceptionType());
            }
        }
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:43,代码来源:ClassPool.java


注:本文中的org.jf.dexlib2.ReferenceType.METHOD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。