org.apache.bcel.classfile.Method.getReturnType()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.apache.bcel.classfile.Method.getReturnType()方法的一些代码示例,展示了Method.getReturnType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.getReturnType()方法的具体详情如下:
包路径:org.apache.bcel.classfile.Method
类名称:Method
方法名:getReturnType

Method.getReturnType介绍

暂无

代码示例

代码示例来源:origin: spotbugs/spotbugs

private void considerMethod(ClassContext classContext, Method method) {
  if ((method.getReturnType() instanceof ReferenceType) && classContext.getMethodGen(method) != null) {
    if (VERBOSE_DEBUG) {
      System.out.println("Check " + method);
    }
    analyzeMethod(classContext, method);
  }
}

代码示例来源:origin: spotbugs/spotbugs

Type returnType = getMethod().getReturnType();
char retSigChar0 = returnType.getSignature().charAt(0);
if ((retSigChar0 == 'V') && (seen == Const.RETURN)) {

代码示例来源:origin: com.g2forge.alexandria/ax-analysis

@Override
  public java.lang.reflect.Type getReturnType() {
    return HBCEL.toJava(method.getReturnType());
  }
}.getFieldName();

代码示例来源:origin: NativeScript/android-dts-generator

private Type getReturnType(Method m) {
  Signature signature = this.getSignature(m);
  if(signature != null) {
    Matcher matcher = methodSignature.matcher(signature.getSignature());
    if(matcher.matches()) {
      String returnSignature = matcher.group(2);
      if(isVoid.matcher(returnSignature).matches()){
        return m.getReturnType(); // returning void
      }
      return GenericUtilities.getType(returnSignature);
    }
  }
  return m.getReturnType();
}

代码示例来源:origin: com.google.code.findbugs/findbugs

private void considerMethod(ClassContext classContext, Method method) {
  if ((method.getReturnType() instanceof ReferenceType) && classContext.getMethodGen(method) != null) {
    if (VERBOSE_DEBUG) {
      System.out.println("Check " + method);
    }
    analyzeMethod(classContext, method);
  }
}

代码示例来源:origin: contra/JMD

private boolean isStringClass(ClassGen cg) {
  if (cg.getMethods().length == 2 && cg.getMethods()[0].isStatic()
      && cg.getMethods()[1].isStatic()) {
    if (cg.getMethods()[0].getReturnType().toString().equals(
        "java.lang.String")
        && cg.getMethods()[1].getReturnType().toString().equals(
        "java.lang.String")) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: contra/JMD

private boolean isStringClassB(ClassGen cg) {
  if (cg.getMethods().length == 1 && cg.getMethods()[0].isStatic()) {
    if (cg.getMethods()[0].getReturnType().toString().equals("java.lang.String")) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: com.h3xstream.findsecbugs/findsecbugs-plugin

@Override
public int hashCode() {
  int hash = 7;
  hash = 67 * hash + bugType.hashCode();
  hash = 67 * hash + originalPriority;
  hash = 67 * hash + classContext.getClassDescriptor().hashCode();
  hash = 67 * hash + method.getName().hashCode();
  hash = 67 * hash + method.getSignature().hashCode();
  hash = 67 * hash + method.getReturnType().hashCode();
  hash = 67 * hash + instructionHandle.getInstruction().getOpcode();
  hash = 67 * hash + instructionHandle.getPosition();
  return hash;
}

代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib

/**
 * implements the visitor to filter out methods that don't return Boolean,
 *
 *
 * @param obj
 *            the context object for the currently parsed code block
 */
@Override
public void visitCode(Code obj) {
  try {
    Method m = getMethod();
    Type retType = m.getReturnType();
    if ("Ljava/lang/Boolean;".equals(retType.getSignature())) {
      stack.resetForMethodEntry(this);
      super.visitCode(obj);
    }
  } catch (StopOpcodeParsingException e) {
    // if the method was already reported
  }
}

代码示例来源:origin: blackarbiter/Android_Code_Arbiter

@Override
  public int hashCode() {
    int hash = 7;
    hash = 67 * hash + bugType.hashCode();
    hash = 67 * hash + originalPriority;
    hash = 67 * hash + classContext.getClassDescriptor().hashCode();
    hash = 67 * hash + method.getName().hashCode();
    hash = 67 * hash + method.getSignature().hashCode();
    hash = 67 * hash + method.getReturnType().hashCode();
    hash = 67 * hash + instructionHandle.getInstruction().getOpcode();
    hash = 67 * hash + instructionHandle.getPosition();
    return hash;
  }
}

代码示例来源:origin: mebigfatguy/fb-contrib

/**
 * implements the visitor to filter out methods that don't return Boolean,
 *
 *
 * @param obj
 *            the context object for the currently parsed code block
 */
@Override
public void visitCode(Code obj) {
  try {
    Method m = getMethod();
    Type retType = m.getReturnType();
    if ("Ljava/lang/Boolean;".equals(retType.getSignature())) {
      stack.resetForMethodEntry(this);
      super.visitCode(obj);
    }
  } catch (StopOpcodeParsingException e) {
    // if the method was already reported
  }
}

代码示例来源:origin: mebigfatguy/fb-contrib

@Override
public void visitCode(Code obj) {
  Method m = getMethod();
  if (m.getReturnType() == Type.VOID) {
    return;
  }
  stack.resetForMethodEntry(this);
  ifBlocks.clear();
  activeUnconditional = null;
  CodeException[] ces = obj.getExceptionTable();
  if (CollectionUtils.isEmpty(ces)) {
    catchPCs = null;
  } else {
    catchPCs = new BitSet();
    for (CodeException ce : ces) {
      catchPCs.set(ce.getHandlerPC());
    }
  }
  gotoBranchPCs.clear();
  casePositions.clear();
  lookingForResetOp = false;
  try {
    super.visitCode(obj);
  } catch (StopOpcodeParsingException e) {
    // reported an issue, so get out
  }
}

代码示例来源:origin: contra/JMD

public boolean isAuthClass(ClassGen cg) {
  if (cg.getMethods().length == 2 && cg.getMethods()[0].getArgumentTypes().length == 1) {
    if (cg.getMethods()[0].getArgumentTypes()[0].getSignature().contains("String")) {
      if (cg.getMethods()[0].getReturnType().toString().contains("boolean")) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib

@Override
public void visitCode(Code obj) {
  Method m = getMethod();
  if (m.getReturnType() == Type.VOID) {
    return;
  }
  stack.resetForMethodEntry(this);
  ifBlocks.clear();
  activeUnconditional = null;
  CodeException[] ces = obj.getExceptionTable();
  if (CollectionUtils.isEmpty(ces)) {
    catchPCs = null;
  } else {
    catchPCs = new BitSet();
    for (CodeException ce : ces) {
      catchPCs.set(ce.getHandlerPC());
    }
  }
  gotoBranchPCs.clear();
  casePositions.clear();
  lookingForResetOp = false;
  try {
    super.visitCode(obj);
  } catch (StopOpcodeParsingException e) {
    // reported an issue, so get out
  }
}

代码示例来源:origin: org.apache.excalibur.fortress.container/excalibur-fortress-container-impl

MethodDesc( Method meth )
{
  this(meth.getName(), meth.getReturnType(), meth.getArgumentTypes(),
      (null == meth.getExceptionTable() ) ? new String[0] : meth.getExceptionTable().getExceptionNames());
}

代码示例来源:origin: com.h3xstream.findsecbugs/findsecbugs-plugin

@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof InjectionSink)) {
    return false;
  }
  final InjectionSink other = (InjectionSink) obj;
  // include only attributes that cannot change after object construction
  return this.bugType.equals(other.bugType)
      && this.originalPriority == other.originalPriority
      && this.classContext.getClassDescriptor().equals(other.classContext.getClassDescriptor())
      && this.method.getName().equals(other.method.getName())
      && this.method.getSignature().equals(other.method.getSignature())
      && this.method.getReturnType().equals(other.method.getReturnType())
      && this.instructionHandle.getInstruction().getOpcode() == other.instructionHandle.getInstruction().getOpcode()
      && this.instructionHandle.getPosition() == other.instructionHandle.getPosition();
}

代码示例来源:origin: blackarbiter/Android_Code_Arbiter

@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof InjectionSink)) {
    return false;
  }
  final InjectionSink other = (InjectionSink) obj;
  // include only attributes that cannot change after object construction
  return this.bugType.equals(other.bugType)
      && this.originalPriority == other.originalPriority
      && this.classContext.getClassDescriptor().equals(other.classContext.getClassDescriptor())
      && this.method.getName().equals(other.method.getName())
      && this.method.getSignature().equals(other.method.getSignature())
      && this.method.getReturnType().equals(other.method.getReturnType())
      && this.instructionHandle.getInstruction().getOpcode() == other.instructionHandle.getInstruction().getOpcode()
      && this.instructionHandle.getPosition() == other.instructionHandle.getPosition();
}

代码示例来源:origin: contra/JMD

public void setDecryptor() {
  for (ClassGen cg : cgs.values()) {
    for (Method m : cg.getMethods()) {
      try {
        if (m.isPublic() && m.isStatic() &&
            m.getArgumentTypes()[0].toString().equals("java.lang.String")
            && m.getReturnType().toString().equals("java.lang.String")) {
          String dc = cg.getClassName() + "." + m.getName();
          decryptor = m.getName();
          decryptorclass = cg.getClassName();
          logger.debug("Found String Decryptor! " + dc);
          return;
        }
      } catch (Exception e) {
        continue;
      }
    }
  }
  logger.error("String decrypt not found!");
}

代码示例来源:origin: contra/JMD

public boolean isLoader(ClassGen cg) {
  return cg.getMethods().length == 3 && cg.getMethods()[1].isStatic()
      && cg.getMethods()[1].isFinal()
      && cg.getMethods()[1].isPublic()
      && cg.getMethods()[1].isSynchronized()
      && cg.getMethods()[1].getReturnType().toString().equals("java.lang.String");
}

代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib

addType(t);
Type resultType = obj.getReturnType();
addType(resultType);
LocalVariableTable lvt = obj.getLocalVariableTable();

相关文章