/** * Add a method annotation for the method which the given visitor is * currently visiting. If the method has source line information, then a * SourceLineAnnotation is added to the method. * * @param visitor * the BetterVisitor * @return this object */ @Nonnull public BugInstance addMethod(PreorderVisitor visitor) { MethodAnnotation methodAnnotation = MethodAnnotation.fromVisitedMethod(visitor); addMethod(methodAnnotation); addSourceLinesForMethod(methodAnnotation, SourceLineAnnotation.fromVisitedMethod(visitor)); return this; }
/** * Add a method annotation. If this is the first method annotation added, it * becomes the primary method annotation. If the method has source line * information, then a SourceLineAnnotation is added to the method. * * @param methodGen * the MethodGen object for the method * @param sourceFile * source file method is defined in * @return this object */ @Nonnull public BugInstance addMethod(MethodGen methodGen, String sourceFile) { String className = methodGen.getClassName(); MethodAnnotation methodAnnotation = new MethodAnnotation(className, methodGen.getName(), methodGen.getSignature(), methodGen.isStatic()); addMethod(methodAnnotation); addSourceLinesForMethod(methodAnnotation, SourceLineAnnotation.fromVisitedMethod(methodGen, sourceFile)); return this; }
/** * Add a method annotation for the method which the given visitor is * currently visiting. If the method has source line information, then a * SourceLineAnnotation is added to the method. * * @param visitor * the BetterVisitor * @return this object */ @Nonnull public BugInstance addMethod(PreorderVisitor visitor) { MethodAnnotation methodAnnotation = MethodAnnotation.fromVisitedMethod(visitor); addMethod(methodAnnotation); addSourceLinesForMethod(methodAnnotation, SourceLineAnnotation.fromVisitedMethod(visitor)); return this; }
/** * Add a method annotation. If this is the first method annotation added, it * becomes the primary method annotation. If the method has source line * information, then a SourceLineAnnotation is added to the method. * * @param methodGen * the MethodGen object for the method * @param sourceFile * source file method is defined in * @return this object */ @Nonnull public BugInstance addMethod(MethodGen methodGen, String sourceFile) { String className = methodGen.getClassName(); MethodAnnotation methodAnnotation = new MethodAnnotation(className, methodGen.getName(), methodGen.getSignature(), methodGen.isStatic()); addMethod(methodAnnotation); addSourceLinesForMethod(methodAnnotation, SourceLineAnnotation.fromVisitedMethod(methodGen, sourceFile)); return this; }