Ensured all java enhanced classes are updated in cache

Since the Scala incremental compiler also does incremental compilation for Java sources, when they are touched by the properties enhancer the cache also has to be updated for them.

Improves on #2274 in that it only updates the cache if Java classes were actually rewritten.