blob: dfb4f22afcbdabc38d2d4efadc768e4de6779df6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// Nik Johnson
// 2-24-2024
// TA: Andy Ruan
import java.util.*;
// checks lines for the characters "System.out.println("")"
public class BlankPrintlnCheck implements Check {
// if the line being checked has a blank println statement, return a new error (code 3)
// takes line and line number
// returns error inside optional
public Optional<Error> lint(String line, int lineNumber) {
if (line.contains("System.out.println(\"\")")) {
return Optional.of(new Error(3, lineNumber, "Line contains blank print statement"));
}
return Optional.empty();
}
}
|