emit error message when Java backend compiler get confused

@andreistefanescu @dwightguth please review. BTW, I would love to have better error message if possible. @andreistefanescu Any suggestions? Thanks.