refactor rule metadata in java backend to use typed attributes

@yilongli please review
You should do this in `RemoveSyntacticCasts` too.