I'm currently creating a grading utility for my university that compiles, lints, run professor-defined tests, etc. In the process, I'm generating a parse tree of the student's source code so I can do things like check imports, check file structure, check for a minimum number of methods, etc. When generating the parse tree, the file must be able to compile (run time errors are a non-factor). The only problem is, not all student submissions actually compile—this is problematic.
Does anyone know of a program that fixes basic Java compilation errors (e.g. missing semi-colons, curly braces, etc.) or of a way that I could go about creating such an application?
I've done some research and the best tool I've found is walkmod, but this merely corrects poorly formatted code rather than actually correcting the issues.
String foo = "this is foo; int bar = 42;
on one line. Well, you close it just before the final;
and now you've got an error on the next lineSystem.out.println(foo + bar);
that bar does not exist... and now you try to solve that error? This path leads to madness or JavaScript (they are quite similar).