Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCharles-Antoine Francisco
27,426 PointsDocProcessor is not detecting missing params
So I tried using the DocProcessor.process method on the MathUtils class but it doesn't show messages for missing parameters, even tough there are some missing in the class.
public class DocProcessor {
public static boolean process(Class clazz) {
// ...
// Does the number of items in param descriptions match
// the number of actual parameters?
int numMissing = getNumMissingParams(method, doc);
if (numMissing > 0) {
methodErrors++;
String message = "%n\t\t=> Missing %s parameter description(s)";
System.out.printf(message, numMissing);
}
}
private static int getNumMissingParams(Method method, Doc doc) {
/* Check if the number of parameter descriptions in the annotation
is less than the method's parameter count */
int actualParamCount = method.getParameterCount();
int annotatedParamCount = doc.params().length;
// Calculate the number of missing parameter descriptions
return actualParamCount - annotatedParamCount;
}