The stub compiler seems to get confused with package-info.groovy, which may need special-casing. This source:
results in the stub
which predictably fails because package-info is not a valid identifier. Given the semantics of package-info.java (and especially that imports aren't allowed), it might make sense to special-case this and just repeat the input file with a trailing semicolon.