handle $1 replacements in java parser

This has been broken for a few months. This brings the java parser into test compliance.