Highlight field in source code pane of Findbugs UI
        Posted  
        
            by Ryan Fernandes
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ryan Fernandes
        
        
        
        Published on 2009-07-02T04:40:11Z
        Indexed on 
            2010/04/29
            3:27 UTC
        
        
        Read the original article
        Hit count: 437
        
I'm using a class that extends BytecodeScanningDetector to check for some problematic fields in a class. After detecting whether the field is problematic, I add it to the bug report like below: Once I run findbugs, it identifies the bug, lists it in the left pane, but does not highlight the corresponding source line.
Any hints/help on this will be very appreciated.
public void visit(Field f) { 
            if (isProblematic(getXField())) { 
                    bugReporter.reportBug(new BugInstance(this, 
                                                     tBugType, 
                                                      HIGH_PRIORITY) 
                                                     .addClass(currentClass) //from visit(JavaClass) 
                                                     .addField(this)); 
            } 
} 
public void visit(JavaClass someObj) { 
            currentClass = someObj.getClassName(); 
}
P.S. I tried posting this on the findbugs list but... no joy.
© Stack Overflow or respective owner