1 19 20 package edu.umd.cs.findbugs.filter; 21 22 import java.util.regex.Pattern ; 23 24 import edu.umd.cs.findbugs.BugInstance; 25 import edu.umd.cs.findbugs.FieldAnnotation; 26 import edu.umd.cs.findbugs.LocalVariableAnnotation; 27 28 29 public class LocalMatcher implements Matcher { 30 private NameMatch name; 31 32 public LocalMatcher(String name) { 33 this.name = new NameMatch(name); 34 } 35 36 public LocalMatcher(String name, String type) { 37 this.name = new NameMatch(name); 38 } 39 40 public boolean match(BugInstance bugInstance) { 41 LocalVariableAnnotation localAnnotation = bugInstance.getPrimaryLocalVariableAnnotation(); 42 if(localAnnotation == null) { 43 return false; 44 } 45 if(!name.match(localAnnotation.getName())) { 46 return false; 47 } 48 return true; 49 } 50 } 51 | Popular Tags |