Another user posted a question here about this
I'm raising the same question here because I think it is a more general issue.
What happens is that when students use raw types the Java compiler generates a message like this:
"Note: <filename> uses unchecked or unsafe operations.
Note: recompile with -xlint:unchecked for details"
It used to be possible to suppress warnings like this at the compiler level by passing a flag like -Xlint:none or -nowarn, but as far as I can see this no longer works.
It is possible to suppress these messages programmatically, and sometimes this could be hidden in a template so that students don't have to know about this feature: @SuppressWarnings("unchecked").
However, if you want a student to submit more than one class in the same answer box, altering the template no longer works. It also doesn't work for a single class if the student must add an import (as the annotation isn't legal before an import). It could be given in the preloaded code, but that would require some more teaching.
Currently CodeRunner reports this as a syntax error
but actually this does not prevent the student's code from compiling and it's not really a syntax error, just an unsafe practice.
I wonder whether warnings like this (another example is the use of deprecated code) could be captured another way, as the current approach prevents tests from running that could actually be run?