Fixed perma-dirty issue with java builds.

This uncovered another issue with the implicit-output ->
implicit-input transformation, where the build does not
know how to regenerate the implicit outputs if they are
manually deleted.
Added a TODO comment, and workaround: now the build will
"fix itself" if you run ninja multiple times.
Added proper implicit-output support for javac.

As a working proof-of-concept, java compilation now
correctly updates when e.g. class files are manually deleted.
Adding doc about implicit inputs/outputs.