In my code, I open file.java and parse it with JavaParser .
FileInputStream in = new FileInputStream(".../file.java"); CompilationUnit cu; try { // parse the file cu = JavaParser.parse(in); } finally { in.close(); } ........
file.java
public class File{ public void ownMethod(){...} public static void main(String[] args){ ownMethod(5);
There is an error in the .java file: the main
method calls the ownMethod
method with one parameter, but ownMethod
expects 0 parameters. JavaParser does not detect this error and parses the .java file with this error. How can I find out (in my code) if there are any errors in file.java? Is this possible without using a java compiler?
source share