This is the result I’ve got from @quirin’s posted example using “javac” 21.0.2:
C:\Users\Gamer>javac SomeJavaCodeWithErrors.java
SomeJavaCodeWithErrors.java:6: error: cannot find symbol
return asdflkj; // line 6, error, but it is reported be on line 3
^
symbol: variable asdflkj
location: class SomeJavaCodeWithErrors
1 error
It infers error is at line 6; but it was 1st reported at line 3!
So Processing is half-right, and it also matches the behavior that all local variables are determined just before a function is actually run.
P.S.: I’ve moved the symbol asdflkj to a println() instead and it only reports that specific line now.
Perhaps b/c the unknown symbol was originally at a return statement, it’s also considered a function error too.