@Override public boolean match(BugInstance bugInstance) { if (!super.match(bugInstance)) { return false; } MethodAnnotation bugMethod = bugInstance.getPrimaryMethod(); if (bugMethod != null && !method.equals(bugMethod)) { return false; } if (DEBUG) { System.out.println("Suppressing " + bugInstance); } return true; } }
/** * @param b * @return */ private String getBugLocation(BugInstance b) { String point; MethodAnnotation m = b.getPrimaryMethod(); FieldAnnotation f = b.getPrimaryField(); if (m != null) { point = m.toString(); } else if (f != null) { point = f.toString(); } else { point = null; } return point; }
private void foundInAutogeneratedMethod() { if (annotationList.size() != 2) { return; } priority+=2; setProperty("FOUND_IN_SYNTHETIC_METHOD", "true"); if (SystemProperties.ASSERTIONS_ENABLED && AnalysisContext.analyzingApplicationClass() && priority <= 3) { AnalysisContext.logError("Adding error " + getBugPattern().getType() + " to synthetic method " + getPrimaryMethod()); } }
@Override public boolean match(BugInstance bugInstance) { if (!super.match(bugInstance)) { return false; } MethodAnnotation bugMethod = bugInstance.getPrimaryMethod(); LocalVariableAnnotation localVariable = bugInstance.getPrimaryLocalVariableAnnotation(); if (bugMethod == null || !method.equals(bugMethod)) { return false; } if (localVariable == null || localVariable.getRegister() != register) { return false; } if (DEBUG) { System.out.println("Suppressing " + bugInstance); } return true; } }
boolean havePrimaryMethods = lhs.getPrimaryMethod() != null && rhs.getPrimaryMethod() != null; cmp = compareMethodsAllowingNull(lhs.getPrimaryMethod(), rhs.getPrimaryMethod()); if (cmp != 0) { if (DEBUG) {
@Nonnull public BugInstance lowerPriorityIfDeprecated() { MethodAnnotation m = getPrimaryMethod(); if (m != null && XFactory.createXMethod(m).isDeprecated()) { lowerPriority(); } FieldAnnotation f = getPrimaryField(); if (f != null && XFactory.createXField(f).isDeprecated()) { lowerPriority(); } return this; }
@Override public boolean match(BugInstance bugInstance) { MethodAnnotation methodAnnotation = null; if (role == null || "".equals(role)) { methodAnnotation = bugInstance.getPrimaryMethod(); } else { for (BugAnnotation a : bugInstance.getAnnotations()) { if (a instanceof MethodAnnotation && role.equals(a.getDescription())) { methodAnnotation = (MethodAnnotation) a; break; } } } if (methodAnnotation == null) { return false; } if (!name.match(methodAnnotation.getMethodName())) { return false; } if (signature != null && !signature.match(methodAnnotation.getMethodSignature())) { return false; } return true; }
MethodAnnotation primeMethod = getPrimaryMethod(); ClassAnnotation primeClass = getPrimaryClass();
MethodAnnotation method = warning.getPrimaryMethod(); if (method != null) { MethodDescriptor methodDesc = method.toMethodDescriptor();
if ((srcLine = inspectPackageMemberSourceLines(getPrimaryMethod())) != null) { return srcLine;
primaryAnnotations.put(getPrimaryClass(), null); primaryAnnotations.put(getPrimaryField(), null); primaryAnnotations.put(getPrimaryMethod(), null); } else { primaryAnnotations = Collections.<BugAnnotation, Void> emptyMap();
@Override public boolean match(BugInstance bugInstance) { if (!super.match(bugInstance)) { return false; } MethodAnnotation bugMethod = bugInstance.getPrimaryMethod(); if (bugMethod != null && !method.equals(bugMethod)) { return false; } if (DEBUG) { System.out.println("Suppressing " + bugInstance); } return true; } }
/** * @param b * @return */ private String getBugLocation(BugInstance b) { String point; MethodAnnotation m = b.getPrimaryMethod(); FieldAnnotation f = b.getPrimaryField(); if (m != null) { point = m.toString(); } else if (f != null) { point = f.toString(); } else { point = null; } return point; }
public void foundInSyntheticMethod() { if (annotationList.size() != 2) { return; } priority+=2; setProperty("FOUND_IN_SYNTHETIC_METHOD", "true"); if (SystemProperties.ASSERTIONS_ENABLED && AnalysisContext.analyzingApplicationClass() && priority <= 3) { AnalysisContext.logError("Adding error " + getBugPattern().getType() + " to synthetic method " + getPrimaryMethod()); } }
@Override public boolean match(BugInstance bugInstance) { if (!super.match(bugInstance)) { return false; } MethodAnnotation bugMethod = bugInstance.getPrimaryMethod(); LocalVariableAnnotation localVariable = bugInstance.getPrimaryLocalVariableAnnotation(); if (bugMethod == null || !method.equals(bugMethod)) { return false; } if (localVariable == null || localVariable.getRegister() != register) { return false; } if (DEBUG) { System.out.println("Suppressing " + bugInstance); } return true; } }
@Nonnull public BugInstance lowerPriorityIfDeprecated() { MethodAnnotation m = getPrimaryMethod(); if (m != null && XFactory.createXMethod(m).isDeprecated()) { lowerPriority(); } FieldAnnotation f = getPrimaryField(); if (f != null && XFactory.createXField(f).isDeprecated()) { lowerPriority(); } return this; }
@Override public boolean match(BugInstance bugInstance) { MethodAnnotation methodAnnotation = null; if (role == null || "".equals(role)) { methodAnnotation = bugInstance.getPrimaryMethod(); } else { for (BugAnnotation a : bugInstance.getAnnotations()) { if (a instanceof MethodAnnotation && role.equals(a.getDescription())) { methodAnnotation = (MethodAnnotation) a; break; } } } if (methodAnnotation == null) { return false; } if (!name.match(methodAnnotation.getMethodName())) { return false; } if (signature != null && !signature.match(methodAnnotation.getMethodSignature())) { return false; } return true; }
@Override public void doReportBug(BugInstance bugInstance) { if(includeCategories.size() > 0 && !includeCategories.contains(bugInstance.getCategoryAbbrev())) { return; } StringBuilder bugDetail = new StringBuilder(); bugDetail .append("\n------------------------------------------------------") .append("\nNew Bug Instance: [" + ++bugInstanceCount + "]") .append("\n message=" + bugInstance.getMessage()) .append("\n bugType=" + bugInstance.getBugPattern().getType()) .append(" priority=" + bugInstance.getPriorityString()) .append(" category=" + bugInstance.getCategoryAbbrev()); if (bugInstance.getPrimaryClass() != null) { bugDetail.append("\n class=" + bugInstance.getPrimaryClass().getClassName()); } if (bugInstance.getPrimaryMethod() != null) { bugDetail.append(" method=" + bugInstance.getPrimaryMethod().getMethodName()); } if (bugInstance.getPrimaryField() != null) { bugDetail.append(" field=" + bugInstance.getPrimaryField().getFieldName()); } if (bugInstance.getPrimarySourceLineAnnotation() != null) { bugDetail.append(" line=" + bugInstance.getPrimarySourceLineAnnotation().getStartLine()); } bugDetail.append("\n------------------------------------------------------"); log.info(bugDetail.toString()); //bugCollection.add(bugInstance); }
@Override protected ActionResult doAccept(BugInstance issue, Ignore action) { final MethodAnnotation method = issue.getPrimaryMethod(); final String className = issue.getPrimaryClass().getClassName(); final String methodName = method == null ? null : method.getMethodName(); final Language language = Language.byFilename(issue.getPrimaryClass().getSourceFileName()); return action.accept(new NamedLocation(issue.getType(), language, className, methodName, true)); }
@Override protected ActionResult doAccept(BugInstance issue, Ignore action) { final MethodAnnotation method = issue.getPrimaryMethod(); final String className = issue.getPrimaryClass().getClassName(); final String methodName = method == null ? null : method.getMethodName(); final Language language = Language.byFilename(issue.getPrimaryClass().getSourceFileName()); return action.accept(new NamedLocation(issue.getType(), language, className, methodName, true)); }