APISonar


org.sonar.squidbridge.api.SourceFile.log

> org > sonar > squidbridge > api > SourceFile > log
org APIs sonar APIs squidbridge APIs api APIs SourceFile APIs log APIs

Example 1
public void leaveClass(AsmClass asmClass) {
    if (this.asmClass != null) {
      for (CheckMessage message : internalNames.values()) {
        SourceFile sourceFile = getSourceFile(asmClass);
        sourceFile.log(message);
      }
    }
  }
Example 2
public void visitMethod(AsmMethod asmMethod) {
    if (!asmMethod.isUsed() && asmMethod.isProtected() && !asmClass.isAbstract() && !SerializableContract.methodMatch(asmMethod)
      && !asmMethod.isInherited()) {
      CheckMessage message = new CheckMessage(this, "Protected method '" + asmMethod.getName() + "(...)' is never used.");
      int line = getMethodLineNumber(asmMethod);
      if (line > 0) {
        message.setLine(line);
      }
      SourceFile file = getSourceFile(asmClass);
      file.log(message);
    }
  }
Example 3
public void visitEdge(AsmEdge edge) {
    if (edge.getTo() instanceof AsmMethod) {
      AsmMethod targetMethod = (AsmMethod) edge.getTo();
      AsmClass targetClass = targetMethod.getParent();
      if ("java/io/File".equals(targetClass.getInternalName()) && "deleteOnExit()V".equals(targetMethod.getKey())) {
        SourceFile sourceFile = getSourceFile(asmClass);
        CheckMessage message = new CheckMessage(this, "Do not use method 'File#deleteOnExit()'.");
        message.setLine(edge.getSourceLineNumber());
        sourceFile.log(message);
      }
    }
  }