Java reflection fixes