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

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

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

Method.isFinal介绍

暂无

代码示例

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

&& (upperBound == null || !upperBound.getJavaClass().isFinal() && !upperBound.getMethod().isFinal())
&& !receiverTypeIsExact;

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

superClinitCall();
if (!method.isStatic() && !method.isPrivate() && !method.isFinal() && !constructor && subtypes != null) {
  for (ClassDescriptor subtype : subtypes) {
    try {

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

@Override
public void visit(Code obj) {
  sawSuperFinalize = false;
  super.visit(obj);
  bugAccumulator.reportAccumulatedBugs();
  if (!"finalize".equals(getMethodName()) || !"()V".equals(getMethodSig())) {
    return;
  }
  String overridesFinalizeIn = Lookup.findSuperImplementor(getDottedClassName(), "finalize", "()V", bugReporter);
  boolean superHasNoFinalizer = "java.lang.Object".equals(overridesFinalizeIn);
  // System.out.println("superclass: " + superclassName);
  if (obj.getCode().length == 1) {
    if (superHasNoFinalizer) {
      if (!getMethod().isFinal()) {
        bugReporter.reportBug(new BugInstance(this, "FI_EMPTY", NORMAL_PRIORITY).addClassAndMethod(this));
      }
    } else {
      bugReporter.reportBug(new BugInstance(this, "FI_NULLIFY_SUPER", NORMAL_PRIORITY).addClassAndMethod(this)
          .addClass(overridesFinalizeIn));
    }
  } else if (obj.getCode().length == 5 && sawSuperFinalize) {
    bugReporter.reportBug(new BugInstance(this, "FI_USELESS", NORMAL_PRIORITY).addClassAndMethod(this));
  } else if (!sawSuperFinalize && !superHasNoFinalizer) {
    bugReporter.reportBug(new BugInstance(this, "FI_MISSING_SUPER_CALL", NORMAL_PRIORITY).addClassAndMethod(this)
        .addClass(overridesFinalizeIn));
  }
}

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

@Nullable
  private Deque<SourceLineAnnotation> foundPrivateInChain(Method m, Set<Method> checkedMethods) {
    Map<Method, SourceLineAnnotation> calledMethods = methodToCalledMethods.get(m);
    if (calledMethods != null) {
      for (Map.Entry<Method, SourceLineAnnotation> entry : calledMethods.entrySet()) {
        Method cm = entry.getKey();
        if (checkedMethods.contains(cm)) {
          continue;
        }

        if (!cm.isPrivate() && !cm.isFinal()) {
          Deque<SourceLineAnnotation> slas = new ArrayDeque<>();
          slas.addLast(entry.getValue());
          return slas;
        }

        checkedMethods.add(cm);
        Deque<SourceLineAnnotation> slas = foundPrivateInChain(cm, checkedMethods);
        if (slas != null) {
          slas.addFirst(entry.getValue());
          return slas;
        }
      }
    }

    return null;
  }
}

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

@Nullable
  private Deque<SourceLineAnnotation> foundNonPrivateNonFinalInChain(Method m, Set<Method> checkedMethods) {
    Map<Method, SourceLineAnnotation> calledMethods = methodToCalledMethods.get(m);
    if (calledMethods != null) {
      for (Map.Entry<Method, SourceLineAnnotation> entry : calledMethods.entrySet()) {
        Method cm = entry.getKey();
        if (checkedMethods.contains(cm)) {
          continue;
        }

        if (!cm.isPrivate() && !cm.isFinal()) {
          Deque<SourceLineAnnotation> slas = new ArrayDeque<>();
          slas.addLast(entry.getValue());
          return slas;
        }

        checkedMethods.add(cm);
        Deque<SourceLineAnnotation> slas = foundNonPrivateNonFinalInChain(cm, checkedMethods);
        if (slas != null) {
          slas.addFirst(entry.getValue());
          return slas;
        }
      }
    }

    return null;
  }
}

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

meth.isFinal = methList[i].isFinal();

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

if (methods[i].isFinal()){
  throw new ClassConstraintException("Method '"+name_and_sig+"' in class '"+hashmap.get(name_and_sig)+"' overrides the final (not-overridable) definition in class '"+jc.getClassName()+"'.");

代码示例来源: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: org.apache.bcel/bcel

if (method.isFinal()) {
  if (!(method.isPrivate())) {
    throw new ClassConstraintException("Method '" + nameAndSig + "' in class '" + hashmap.get(nameAndSig) +

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

&& (upperBound == null || !upperBound.getJavaClass().isFinal() && !upperBound.getMethod().isFinal())
&& !receiverTypeIsExact;

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

superClinitCall();
if (!method.isStatic() && !method.isPrivate() && !method.isFinal() && !constructor && subtypes != null) {
  for (ClassDescriptor subtype : subtypes) {
    try {

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

@Override
public void visit(Code obj) {
  sawSuperFinalize = false;
  super.visit(obj);
  bugAccumulator.reportAccumulatedBugs();
  if (!"finalize".equals(getMethodName()) || !"()V".equals(getMethodSig())) {
    return;
  }
  String overridesFinalizeIn = Lookup.findSuperImplementor(getDottedClassName(), "finalize", "()V", bugReporter);
  boolean superHasNoFinalizer = "java.lang.Object".equals(overridesFinalizeIn);
  // System.out.println("superclass: " + superclassName);
  if (obj.getCode().length == 1) {
    if (superHasNoFinalizer) {
      if (!getMethod().isFinal()) {
        bugReporter.reportBug(new BugInstance(this, "FI_EMPTY", NORMAL_PRIORITY).addClassAndMethod(this));
      }
    } else {
      bugReporter.reportBug(new BugInstance(this, "FI_NULLIFY_SUPER", NORMAL_PRIORITY).addClassAndMethod(this)
          .addClass(overridesFinalizeIn));
    }
  } else if (obj.getCode().length == 5 && sawSuperFinalize) {
    bugReporter.reportBug(new BugInstance(this, "FI_USELESS", NORMAL_PRIORITY).addClassAndMethod(this));
  } else if (!sawSuperFinalize && !superHasNoFinalizer) {
    bugReporter.reportBug(new BugInstance(this, "FI_MISSING_SUPER_CALL", NORMAL_PRIORITY).addClassAndMethod(this)
        .addClass(overridesFinalizeIn));
  }
}

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

if (cls != null) {
  Method m = findMethod(cls, getNameConstantOperand(), getSigConstantOperand());
  if ((m != null) && (!m.isFinal())) {
    if (isCtor && (seen != INVOKESPECIAL)) {
      bugReporter.reportBug(new BugInstance(this, BugType.PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS.name(), NORMAL_PRIORITY)

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

Method m = findMethod(cls, getNameConstantOperand(), getSigConstantOperand());
if (m != null) {
  if (isCtor && (seen != Const.INVOKESPECIAL) && !m.isFinal()) {
    bugReporter.reportBug(new BugInstance(this, BugType.PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS.name(), NORMAL_PRIORITY)
        .addClass(this).addMethod(this).addSourceLine(this, getPC()));

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

if (classIsFinal || classIsAnonymous || method.isStatic() || method.isPrivate() || method.isFinal()
    || ((Values.CONSTRUCTOR.equals(method.getName()) && !isAnonymousInnerCtor(method, getThisClass())))) {
  String[] exNames = et.getExceptionNames();

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

if (classIsFinal || classIsAnonymous || method.isStatic() || method.isPrivate() || method.isFinal()
    || ((Values.CONSTRUCTOR.equals(method.getName()) && !isAnonymousInnerCtor(method, getThisClass())))) {
  String[] exNames = et.getExceptionNames();

代码示例来源:origin: org.apache.bcel/bcel

if (obj.isFinal()) {
  throw new ClassConstraintException(
    "Abstract method '"+tostring(obj)+"' must not have the ACC_FINAL modifier set.");
    obj.isFinal() ||
    obj.isSynchronized() ||
    obj.isNative() ||
      || obj.isFinal()
      || obj.isSynchronized()
      || obj.isNative()) {
      || obj.isProtected()
      || obj.isStatic()
      || obj.isFinal()
      || obj.isSynchronized()
      || obj.isNative()

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

if (obj.isFinal()) throw new ClassConstraintException("Abstract method '"+tostring(obj)+"' must not have the ACC_FINAL modifier set.");
if (obj.isNative()) throw new ClassConstraintException("Abstract method '"+tostring(obj)+"' must not have the ACC_NATIVE modifier set.");
if (obj.isPrivate()) throw new ClassConstraintException("Abstract method '"+tostring(obj)+"' must not have the ACC_PRIVATE modifier set.");
      obj.isProtected() ||
      obj.isStatic() ||
      obj.isFinal() ||
      obj.isSynchronized() ||
      obj.isNative() ||
    obj.isFinal() ||
    obj.isSynchronized() ||
    obj.isNative() ||

相关文章